mirror of
https://github.com/TeamAmaze/AmazeFileManager.git
synced 2026-10-17 05:08:00 +08:00
Change param to context
This commit is contained in:
@@ -28,7 +28,6 @@ import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.EditText
|
||||
import android.widget.Toast
|
||||
import com.amaze.filemanager.R
|
||||
import com.amaze.filemanager.ui.activities.MainActivity
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
|
||||
private const val TAG = "ExtensionsKt"
|
||||
@@ -57,12 +56,12 @@ fun Context.startActivityCatchingSecurityException(intent: Intent) {
|
||||
/**
|
||||
* Force keyboard pop up on focus
|
||||
*/
|
||||
fun EditText.openKeyboard(mainActivity: MainActivity) {
|
||||
fun EditText.openKeyboard(context: Context) {
|
||||
this.requestFocus()
|
||||
|
||||
this.postDelayed(
|
||||
{
|
||||
(mainActivity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager)
|
||||
(context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager)
|
||||
.showSoftInput(
|
||||
this,
|
||||
InputMethodManager.SHOW_IMPLICIT
|
||||
|
||||
@@ -162,7 +162,7 @@ public class GeneralDialogCreation {
|
||||
WarnableTextInputLayout tilTextfield =
|
||||
dialogView.findViewById(R.id.singleedittext_warnabletextinputlayout);
|
||||
|
||||
dialogView.post(() -> ExtensionsKt.openKeyboard(textfield, m));
|
||||
dialogView.post(() -> ExtensionsKt.openKeyboard(textfield, m.getApplicationContext()));
|
||||
|
||||
builder
|
||||
.customView(dialogView, false)
|
||||
@@ -880,7 +880,7 @@ public class GeneralDialogCreation {
|
||||
MDButton btnOK = dialog.getActionButton(DialogAction.POSITIVE);
|
||||
btnOK.setEnabled(false);
|
||||
|
||||
rootView.post(() -> ExtensionsKt.openKeyboard(passwordEditText, main));
|
||||
rootView.post(() -> ExtensionsKt.openKeyboard(passwordEditText, main.getApplicationContext()));
|
||||
|
||||
TextWatcher textWatcher =
|
||||
new SimpleTextWatcher() {
|
||||
@@ -1021,7 +1021,7 @@ public class GeneralDialogCreation {
|
||||
textfield.setHint(promptText);
|
||||
textfield.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
|
||||
dialogLayout.post(() -> ExtensionsKt.openKeyboard(textfield, main));
|
||||
dialogLayout.post(() -> ExtensionsKt.openKeyboard(textfield, main.getApplicationContext()));
|
||||
|
||||
builder
|
||||
.customView(dialogLayout, false)
|
||||
@@ -1120,7 +1120,8 @@ public class GeneralDialogCreation {
|
||||
WarnableTextInputLayout tilFilename =
|
||||
dialogView.findViewById(R.id.singleedittext_warnabletextinputlayout);
|
||||
|
||||
dialogView.post(() -> ExtensionsKt.openKeyboard(etFilename, mainActivity));
|
||||
dialogView.post(
|
||||
() -> ExtensionsKt.openKeyboard(etFilename, mainActivity.getApplicationContext()));
|
||||
|
||||
a.customView(dialogView, false)
|
||||
.widgetColor(accentColor)
|
||||
|
||||
Reference in New Issue
Block a user