Merge pull request #1673 from michaelschattgen/feature/disable-autofill-pin-keyboard
Add custom EditText to prevent Autofill service from popping up
This commit is contained in:
@@ -42,6 +42,7 @@ import com.beemdevelopment.aegis.vault.slots.SlotException;
|
||||
import com.beemdevelopment.aegis.vault.slots.SlotIntegrityException;
|
||||
import com.beemdevelopment.aegis.vault.slots.SlotList;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -72,7 +73,22 @@ public class AuthActivity extends AegisActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_auth);
|
||||
_textPassword = findViewById(R.id.text_password);
|
||||
|
||||
TextInputLayout layoutStandard = findViewById(R.id.layout_standard);
|
||||
TextInputLayout layoutNoAutofill = findViewById(R.id.layout_no_autofill);
|
||||
EditText editStandard = findViewById(R.id.text_password);
|
||||
EditText editNoAutofill = findViewById(R.id.text_password_no_autofill);
|
||||
|
||||
if (_prefs.isPinKeyboardEnabled()) {
|
||||
layoutStandard.setVisibility(View.GONE);
|
||||
layoutNoAutofill.setVisibility(View.VISIBLE);
|
||||
_textPassword = editNoAutofill;
|
||||
} else {
|
||||
layoutStandard.setVisibility(View.VISIBLE);
|
||||
layoutNoAutofill.setVisibility(View.GONE);
|
||||
_textPassword = editStandard;
|
||||
}
|
||||
|
||||
LinearLayout boxBiometricInfo = findViewById(R.id.box_biometric_info);
|
||||
_decryptButton = findViewById(R.id.button_decrypt);
|
||||
TextView biometricsButton = findViewById(R.id.button_biometrics);
|
||||
@@ -86,10 +102,6 @@ public class AuthActivity extends AegisActivity {
|
||||
return false;
|
||||
});
|
||||
|
||||
if (_prefs.isPinKeyboardEnabled()) {
|
||||
_textPassword.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD);
|
||||
}
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (savedInstanceState == null) {
|
||||
_inhibitBioPrompt = intent.getBooleanExtra("inhibitBioPrompt", false);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.beemdevelopment.aegis.ui.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
public class NoAutofillEditText extends TextInputEditText {
|
||||
|
||||
public NoAutofillEditText(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public NoAutofillEditText(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public NoAutofillEditText(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAutofillType() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
return View.AUTOFILL_TYPE_NONE;
|
||||
} else {
|
||||
return super.getAutofillType();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,19 +42,39 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/layout_standard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="12dp"
|
||||
app:hintEnabled="false"
|
||||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="?attr/colorOnSurface">
|
||||
app:passwordToggleTint="?attr/colorOnSurface"
|
||||
android:visibility="visible">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/text_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/password"
|
||||
android:inputType="textPassword" />
|
||||
android:inputType="textPassword"/>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/layout_no_autofill"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="12dp"
|
||||
app:hintEnabled="false"
|
||||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="?attr/colorOnSurface"
|
||||
android:visibility="gone">
|
||||
|
||||
<com.beemdevelopment.aegis.ui.components.NoAutofillEditText
|
||||
android:id="@+id/text_password_no_autofill"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/password"
|
||||
android:inputType="numberPassword"/>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
||||
Reference in New Issue
Block a user