Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #122 #131

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/src/main/kotlin/rasel/lunar/launcher/LauncherActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ internal class LauncherActivity : AppCompatActivity() {

view.updatePadding(0, topInset, 0, it.bottom)
}
WindowInsetsCompat.CONSUMED
// return the insets to get it in AppDrawer>handleWindowInsets()
windowInsets
}
}

Expand Down
25 changes: 24 additions & 1 deletion app/src/main/kotlin/rasel/lunar/launcher/apps/AppDrawer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.content.pm.ResolveInfo
import android.content.res.Configuration
import android.graphics.Rect
import android.os.Build
import android.os.Bundle
Expand All @@ -34,7 +35,10 @@ import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updateLayoutParams
import androidx.core.view.updatePadding
import androidx.core.widget.doOnTextChanged
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.GridLayoutManager
Expand All @@ -57,7 +61,6 @@ import rasel.lunar.launcher.helpers.Constants.Companion.KEY_STATUS_BAR
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_APP_NAMES
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import java.text.Normalizer
import java.util.*
import java.util.regex.Pattern


Expand Down Expand Up @@ -125,6 +128,7 @@ internal class AppDrawer : Fragment() {
setLayout()
fetchApps()
getAlphabetItems()
handleWindowInsets()
setKeyboardPadding()

return binding.root
Expand Down Expand Up @@ -242,6 +246,25 @@ internal class AppDrawer : Fragment() {
}
}

@SuppressLint("RtlHardcoded")
private fun handleWindowInsets() {
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, windowInsets ->
if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars()).let {
val leftInsets =
if (settingsPrefs!!.getInt(KEY_DRAW_ALIGN, Gravity.CENTER) == Gravity.LEFT ||
settingsPrefs!!.getInt(KEY_APPS_LAYOUT, 0) != 0) {
it.left
} else 0

binding.root.updatePadding(leftInsets, 0, it.right, 0)
}
}

WindowInsetsCompat.CONSUMED
}
}

private fun filterAppsList(searchString: String) {
/* check each app name and add if it matches the search string */
packageList.clear()
Expand Down
Loading