-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable default keyboard dismiss behaviour
Signed-off-by: alperozturk <[email protected]>
- Loading branch information
1 parent
dc898c0
commit 2ec47dd
Showing
4 changed files
with
56 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
app/src/main/java/com/owncloud/android/ui/components/PassCodeEditText.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Nextcloud Android client application | ||
* | ||
* @author Alper Ozturk | ||
* Copyright (C) 2023 Alper Ozturk | ||
* Copyright (C) 2023 Nextcloud GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.owncloud.android.ui.components | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.view.KeyEvent | ||
import androidx.appcompat.widget.AppCompatEditText | ||
|
||
class PassCodeEditText(context: Context, attrs: AttributeSet?): AppCompatEditText(context, attrs) { | ||
|
||
override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean { | ||
val isBackButtonPressed = (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) | ||
if (isBackButtonPressed) { | ||
// Override default behaviour and prevent dismissing the keyboard | ||
return true | ||
} | ||
return super.dispatchKeyEvent(event) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters