Handle click events as well (useful when password field is the only focusable view)

This commit is contained in:
Matthew Wong 2015-08-09 22:05:20 -04:00
parent ad173d9d05
commit 1ceb41acb6
3 changed files with 15 additions and 2 deletions

View file

@ -1,6 +1,7 @@
package com.zeapo.pwdstore.autofill; package com.zeapo.pwdstore.autofill;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment; import android.app.DialogFragment;
@ -13,6 +14,7 @@ import android.widget.EditText;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RadioGroup; import android.widget.RadioGroup;
import com.zeapo.pwdstore.PasswordStore;
import com.zeapo.pwdstore.R; import com.zeapo.pwdstore.R;
public class AutofillFragment extends DialogFragment { public class AutofillFragment extends DialogFragment {
@ -50,6 +52,17 @@ public class AutofillFragment extends DialogFragment {
((EditText) view.findViewById(R.id.matched)).setText(preference); ((EditText) view.findViewById(R.id.matched)).setText(preference);
} }
View.OnClickListener matchPassword = new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO figure out UI for this
Intent intent = new Intent(getActivity(), PasswordStore.class);
startActivity(intent);
}
};
view.findViewById(R.id.match).setOnClickListener(matchPassword);
view.findViewById(R.id.matched).setOnClickListener(matchPassword);
final SharedPreferences.Editor editor = prefs.edit(); final SharedPreferences.Editor editor = prefs.edit();
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override @Override

View file

@ -60,7 +60,7 @@ public class AutofillService extends AccessibilityService {
serviceConnection.bindToService(); serviceConnection.bindToService();
settings = PreferenceManager.getDefaultSharedPreferences(this); settings = PreferenceManager.getDefaultSharedPreferences(this);
} }
// TODO handle CLICKS and change search/search results (just use first result) // TODO change search/search results (just use first result)
@Override @Override
public void onAccessibilityEvent(AccessibilityEvent event) { public void onAccessibilityEvent(AccessibilityEvent event) {
// if returning to the source app from a successful AutofillActivity // if returning to the source app from a successful AutofillActivity

View file

@ -1,6 +1,6 @@
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android" <accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/autofill_description" android:description="@string/autofill_description"
android:accessibilityEventTypes="typeViewFocused|typeWindowStateChanged" android:accessibilityEventTypes="typeViewFocused|typeWindowStateChanged|typeViewClicked"
android:accessibilityFlags="flagDefault" android:accessibilityFlags="flagDefault"
android:accessibilityFeedbackType="feedbackGeneric" android:accessibilityFeedbackType="feedbackGeneric"
android:notificationTimeout="100" android:notificationTimeout="100"