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

Added menu key press for feature phones to open app list. #308

Closed
wants to merge 2 commits into from
Closed
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
22 changes: 22 additions & 0 deletions app/src/main/java/app/olaunchercf/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.os.Build
import android.os.Bundle
import android.provider.Settings
import android.util.Log
import android.view.KeyEvent
import android.view.View
import android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
import androidx.appcompat.app.AppCompatActivity
Expand Down Expand Up @@ -68,6 +69,27 @@ class MainActivity : AppCompatActivity() {
window.addFlags(FLAG_LAYOUT_NO_LIMITS)
}

override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
return when (keyCode) {
KeyEvent.KEYCODE_MENU -> {
when (navController.currentDestination?.id) {
R.id.mainFragment -> {
Navigation.findNavController(this, R.id.nav_host_fragment)
.navigate(R.id.action_mainFragment_to_appListFragment)
true
}

else -> {
false
}
}
}
else -> {
super.onKeyDown(keyCode, event)
}
}
}

@Suppress("DEPRECATION")
fun setLanguage() {
val locale = Locale(prefs.language.value())
Expand Down
Loading