Fix: Fixed the navigation well adding hidden apps to swipes

Signed-off-by: HeCodes2Much <wayne6324@gmail.com>
This commit is contained in:
HeCodes2Much
2024-06-17 16:55:58 +01:00
parent 1f929cfeee
commit aa030e4635
9 changed files with 34 additions and 21 deletions

View File

@@ -152,7 +152,7 @@ class DrawFragment : Fragment(),
@SuppressLint("ClickableViewAccessibility")
private fun observeSwipeTouchListener() {
binding.touchArea.setOnTouchListener(getSwipeGestureListener(context))
binding.mainView.setOnTouchListener(getSwipeGestureListener(context))
binding.drawAdapter.setOnTouchListener(getSwipeGestureListener(context))
}

View File

@@ -98,7 +98,7 @@ class HiddenFragment : Fragment(),
@SuppressLint("ClickableViewAccessibility")
private fun observeSwipeTouchListener() {
binding.touchArea.setOnTouchListener(getSwipeGestureListener(context))
binding.fragmentContainer.setOnTouchListener(getSwipeGestureListener(context))
binding.hiddenAdapter.setOnTouchListener(getSwipeGestureListener(context))
}

View File

@@ -1,6 +1,7 @@
package com.github.droidworksstudio.launcher.ui.hidden
import android.util.Log
import android.view.Gravity
import android.view.View
import androidx.appcompat.widget.LinearLayoutCompat
import androidx.recyclerview.widget.RecyclerView
@@ -19,11 +20,14 @@ class HiddenViewHolder(
fun bind(appInfo: AppInfo) {
binding.apply {
// Get the current LayoutParams of appFavoriteName
val layoutParams = appHiddenName.layoutParams as LinearLayoutCompat.LayoutParams
// Set the margins
layoutParams.topMargin = preferenceHelper.homeAppPadding.toInt()
layoutParams.bottomMargin = preferenceHelper.homeAppPadding.toInt()
val layoutParams = LinearLayoutCompat.LayoutParams(
LinearLayoutCompat.LayoutParams.WRAP_CONTENT,
LinearLayoutCompat.LayoutParams.WRAP_CONTENT
).apply {
gravity = Gravity.START
topMargin = preferenceHelper.homeAppPadding.toInt()
bottomMargin = preferenceHelper.homeAppPadding.toInt()
}
appHiddenName.layoutParams = layoutParams
appHiddenName.text = appInfo.appName

View File

@@ -364,6 +364,17 @@ class HomeFragment : Fragment(),
}
}
Constants.Action.ShowHiddenList -> {
val actionTypeNavOptions: NavOptions = appHelper.getActionType(actionType)
Handler(Looper.getMainLooper()).post {
findNavController().navigate(
R.id.action_HomeFragment_to_HiddenFragment,
null,
actionTypeNavOptions
)
}
}
Constants.Action.OpenQuickSettings -> {
appHelper.expandQuickSettings(context)
}

View File

@@ -113,6 +113,7 @@ object Constants {
ShowNotification,
ShowAppList,
ShowFavoriteList,
ShowHiddenList,
OpenQuickSettings,
ShowRecents,
ShowWidgets,
@@ -127,6 +128,7 @@ object Constants {
ShowNotification -> context.getString(R.string.settings_actions_show_notifications)
ShowAppList -> context.getString(R.string.settings_actions_show_app_list)
ShowFavoriteList -> context.getString(R.string.settings_actions_show_favorite_list)
ShowHiddenList -> context.getString(R.string.settings_actions_show_hidden_list)
OpenQuickSettings -> context.getString(R.string.settings_actions_open_quick_settings)
ShowRecents -> context.getString(R.string.settings_actions_show_recents)
ShowWidgets -> context.getString(R.string.settings_actions_show_widgets)

View File

@@ -7,12 +7,6 @@
android:id="@+id/draw_background"
tools:context=".ui.drawer.DrawFragment">
<FrameLayout
android:id="@+id/touchArea"
android:layout_marginVertical="20dp"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/mainView"
android:layout_width="match_parent"

View File

@@ -7,12 +7,6 @@
android:id="@+id/hidden_view"
tools:context=".ui.hidden.HiddenFragment">
<FrameLayout
android:id="@+id/touchArea"
android:layout_marginVertical="20dp"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
@@ -32,11 +26,12 @@
android:textSize="@dimen/text_super_large"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
app:layout_constraintEnd_toEndOf="parent"
style="@style/TextDefaultStyle" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/hiddenAdapter"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="92dp"

View File

@@ -19,6 +19,9 @@
<action
android:id="@+id/action_HomeFragment_to_FavoriteFragment"
app:destination="@id/FavoriteFragment" />
<action
android:id="@+id/action_HomeFragment_to_HiddenFragment"
app:destination="@id/HiddenFragment" />
<action
android:id="@+id/action_HomeFragment_to_WidgetsFragment"
app:destination="@id/WidgetsFragment" />
@@ -35,6 +38,9 @@
<action
android:id="@+id/action_SettingsFragment_to_HiddenFragment"
app:destination="@id/HiddenFragment" />
<action
android:id="@+id/action_SettingsFragment_to_WidgetsSettingsFragment"
app:destination="@id/WidgetsSettingsFragment" />
</fragment>
<fragment

View File

@@ -102,6 +102,7 @@
<string name="settings_actions_show_notifications">Show Notifications</string>
<string name="settings_actions_show_app_list">Show Apps List</string>
<string name="settings_actions_show_favorite_list">Show Favorites List</string>
<string name="settings_actions_show_hidden_list">Show Hidden List</string>
<string name="settings_actions_open_quick_settings">Open Quick Settings</string>
<string name="settings_actions_show_recents">Show Recents</string>
<string name="settings_actions_show_widgets">Show Widgets</string>