Fix: Hide self from app list.
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
package com.github.droidworksstudio.launcher
|
package com.github.droidworksstudio.launcher
|
||||||
|
|
||||||
object Constants {
|
object Constants {
|
||||||
const val PACKAGE_NAME = "com.github.droidworksstudio.launcher"
|
const val PACKAGE_NAME = "app.easy.launcher"
|
||||||
|
const val PACKAGE_NAME_DEBUG = "$PACKAGE_NAME.debug"
|
||||||
|
|
||||||
const val PREFS_FILENAME = "EasyLauncher.pref"
|
const val PREFS_FILENAME = "EasyLauncher.pref"
|
||||||
const val FIRST_LAUNCH = "FIRST_LAUNCH"
|
const val FIRST_LAUNCH = "FIRST_LAUNCH"
|
||||||
|
|||||||
@@ -109,14 +109,14 @@ class AppInfoRepository @Inject constructor(
|
|||||||
val launcherApps =
|
val launcherApps =
|
||||||
context.getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
context.getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
||||||
|
|
||||||
val excludedPackageName = Constants.PACKAGE_NAME
|
val excludedPackageNames = mutableListOf(Constants.PACKAGE_NAME,Constants.PACKAGE_NAME_DEBUG)
|
||||||
|
|
||||||
val newAppList: List<AppInfo> = userManager.userProfiles
|
val newAppList: List<AppInfo> = userManager.userProfiles
|
||||||
.flatMap { profile ->
|
.flatMap { profile ->
|
||||||
launcherApps.getActivityList(null, profile)
|
launcherApps.getActivityList(null, profile)
|
||||||
.mapNotNull { app ->
|
.mapNotNull { app ->
|
||||||
val packageName = app.applicationInfo.packageName
|
val packageName = app.applicationInfo.packageName
|
||||||
if (packageName !in existingPackageNames && packageName != excludedPackageName) {
|
if (packageName !in existingPackageNames && packageName !in excludedPackageNames) {
|
||||||
AppInfo(
|
AppInfo(
|
||||||
appName = app.label.toString(),
|
appName = app.label.toString(),
|
||||||
packageName = packageName,
|
packageName = packageName,
|
||||||
|
|||||||
@@ -18,12 +18,12 @@
|
|||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:visibility="visible"
|
android:visibility="gone"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/linear_layout"/>
|
app:layout_constraintTop_toTopOf="@id/linear_layout"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:visibility="visible"
|
android:visibility="gone"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/linear_layout"/>
|
app:layout_constraintTop_toTopOf="@id/linear_layout"/>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user