Fix: Fixed the touch area for HomeFragment

Signed-off-by: HeCodes2Much <wayne6324@gmail.com>
This commit is contained in:
HeCodes2Much
2024-08-24 15:49:43 +01:00
parent 97461410fb
commit 5c77a238d5
3 changed files with 35 additions and 15 deletions

View File

@@ -13,12 +13,12 @@ plugins {
android {
namespace = "com.github.droidworksstudio.launcher"
compileSdk = 34
compileSdk = 35
defaultConfig {
applicationId = "app.easy.launcher"
minSdk = 24
targetSdk = 34
targetSdk = 35
versionCode = 23
versionName = "0.2.3"

View File

@@ -15,6 +15,7 @@ import android.os.Looper
import android.text.format.DateFormat
import android.util.Log
import android.view.*
import android.widget.LinearLayout
import androidx.annotation.RequiresApi
import androidx.appcompat.widget.AppCompatTextView
import androidx.biometric.BiometricPrompt
@@ -191,13 +192,31 @@ class HomeFragment : Fragment(),
private fun setupRecyclerView() {
val marginTopInPixels = 128
val params: ViewGroup.MarginLayoutParams =
binding.appListAdapter.layoutParams as ViewGroup.MarginLayoutParams
params.topMargin = marginTopInPixels
val params: ViewGroup.LayoutParams = binding.appListAdapter.layoutParams
var layoutParams = if (params is LinearLayout.LayoutParams) {
params
} else {
LinearLayout.LayoutParams(params)
}
layoutParams.topMargin = marginTopInPixels
when (preferenceHelper.homeAppAlignment) {
Gravity.START -> {
layoutParams.gravity = Gravity.START
}
Gravity.CENTER -> {
layoutParams.gravity = Gravity.CENTER
}
Gravity.END -> {
layoutParams.gravity = Gravity.END
}
}
binding.appListAdapter.apply {
adapter = homeAdapter
layoutParams = params
layoutParams = layoutParams
setHasFixedSize(false)
layoutManager = StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)
isNestedScrollingEnabled = false

View File

@@ -9,12 +9,6 @@
android:orientation="vertical"
tools:context=".ui.home.HomeFragment">
<FrameLayout
android:id="@+id/touchArea"
android:layout_marginVertical="20dp"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.github.droidworksstudio.launcher.view.GestureNestedScrollView
android:id="@+id/nestScrollView"
android:layout_width="match_parent"
@@ -87,11 +81,18 @@
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/appListAdapter"
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/touchArea"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/appListAdapter"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
</com.github.droidworksstudio.launcher.view.GestureNestedScrollView>