add always show dialog preference.

This commit is contained in:
Matthew Wong 2015-12-30 01:18:42 -05:00
parent 5263ed10bb
commit ebd565ec37
6 changed files with 28 additions and 20 deletions

View file

@ -4,7 +4,7 @@ apply plugin: 'eclipse'
android { android {
compileSdkVersion 23 compileSdkVersion 23
buildToolsVersion "23.0.1" buildToolsVersion "23.0.2"
defaultConfig { defaultConfig {
applicationId "com.zeapo.pwdstore" applicationId "com.zeapo.pwdstore"
minSdkVersion 15 minSdkVersion 15
@ -56,10 +56,10 @@ android {
} }
dependencies { dependencies {
compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.0.1' compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.0.1' compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:design:23.0.1' compile 'com.android.support:design:23.1.1'
compile 'org.sufficientlysecure:openpgp-api:9.0' compile 'org.sufficientlysecure:openpgp-api:9.0'
compile ('org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r') { compile ('org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient' exclude group: 'org.apache.httpcomponents', module: 'httpclient'

View file

@ -40,8 +40,7 @@ public class AutofillFragment extends DialogFragment {
final AutofillPreferenceActivity callingActivity = (AutofillPreferenceActivity) getActivity(); final AutofillPreferenceActivity callingActivity = (AutofillPreferenceActivity) getActivity();
LayoutInflater inflater = callingActivity.getLayoutInflater(); LayoutInflater inflater = callingActivity.getLayoutInflater();
final View view = View.inflate(callingActivity.getApplicationContext() final View view = inflater.inflate(R.layout.fragment_autofill, null);
, R.layout.fragment_autofill, null);
builder.setView(view); builder.setView(view);

View file

@ -149,7 +149,9 @@ public class AutofillService extends AccessibilityService {
appName = setMatchingPasswordsWeb(webViewTitle); appName = setMatchingPasswordsWeb(webViewTitle);
} }
if (items.isEmpty()) { // show anyway preference? // if autofill_always checked, show dialog even if no matches (automatic
// or otherwise)
if (items.isEmpty() && !settings.getBoolean("autofill_always", false)) {
return; return;
} }
showDialog(appName); showDialog(appName);
@ -210,7 +212,7 @@ public class AutofillService extends AccessibilityService {
items = searchPasswords(PasswordRepository.getRepositoryDirectory(this), appName); items = searchPasswords(PasswordRepository.getRepositoryDirectory(this), appName);
break; break;
case "/never": case "/never":
items.clear(); items = new ArrayList<>();
return; return;
default: default:
getPreferredPasswords(preference); getPreferredPasswords(preference);
@ -234,7 +236,7 @@ public class AutofillService extends AccessibilityService {
} }
items = searchPasswords(PasswordRepository.getRepositoryDirectory(this), webViewTitle); items = searchPasswords(PasswordRepository.getRepositoryDirectory(this), webViewTitle);
} else { } else {
items.clear(); items = new ArrayList<>();
} }
return webViewTitle; return webViewTitle;
} }
@ -255,7 +257,6 @@ public class AutofillService extends AccessibilityService {
} }
} }
private ArrayList<File> searchPasswords(File path, String appName) { private ArrayList<File> searchPasswords(File path, String appName) {
ArrayList<File> passList ArrayList<File> passList
= PasswordRepository.getFilesList(path); = PasswordRepository.getFilesList(path);
@ -322,12 +323,15 @@ public class AutofillService extends AccessibilityService {
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
// arbitrary non-annoying size // arbitrary non-annoying size
int height = 144; int height = 88;
if (items.size() > 1) { if (items.size() > 0) {
height += 48; height += 66;
} }
dialog.getWindow().setLayout((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 240, getResources().getDisplayMetrics()) if (items.size() > 1) {
, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, height, getResources().getDisplayMetrics())); height += 33;
}
dialog.getWindow().setLayout((int) (240 * getApplicationContext().getResources().getDisplayMetrics().density)
, (int) (height * getApplicationContext().getResources().getDisplayMetrics().density));
dialog.show(); dialog.show();
} }

View file

@ -112,7 +112,7 @@
<string name="pref_password_dialog_title">Set the time you want the password to be in clipboard</string> <string name="pref_password_dialog_title">Set the time you want the password to be in clipboard</string>
<string name="pref_copy_title">Automatically Copy Password</string> <string name="pref_copy_title">Automatically Copy Password</string>
<string name="pref_copy_dialog_title">Automatically copy the password to the clipboard after decryption was successful.</string> <string name="pref_copy_dialog_title">Automatically copy the password to the clipboard after decryption was successful.</string>
<string name="ssh_key_success_dialog_title" translatable="false">SSH-key imported</string> <string name="ssh_key_success_dialog_title">SSH-key imported</string>
<string name="ssh_key_error_dialog_title">Error while trying to import the ssh-key</string> <string name="ssh_key_error_dialog_title">Error while trying to import the ssh-key</string>
<string name="ssh_key_error_dialog_text">Message : \n</string> <string name="ssh_key_error_dialog_text">Message : \n</string>
<string name="pref_recursive_filter">Recursive filtering</string> <string name="pref_recursive_filter">Recursive filtering</string>
@ -121,10 +121,11 @@
<string name="pref_autofill_enable_msg">Tap OK to go to Accessibility settings. There, tap Password Store under Services then tap the switch in the top right to turn it on or off.</string> <string name="pref_autofill_enable_msg">Tap OK to go to Accessibility settings. There, tap Password Store under Services then tap the switch in the top right to turn it on or off.</string>
<string name="pref_autofill_enable_msg2">Once the service is on, a dialog will appear when you click on a password field in an app if a matching password for the app exists.</string> <string name="pref_autofill_enable_msg2">Once the service is on, a dialog will appear when you click on a password field in an app if a matching password for the app exists.</string>
<string name="pref_autofill_enable_msg3">Password Store attempts to match apps with passwords automatically. You can change this default setting and also matching settings per-app.</string> <string name="pref_autofill_enable_msg3">Password Store attempts to match apps with passwords automatically. You can change this default setting and also matching settings per-app.</string>
<string name="pref_autofill_apps_title">Per-app settings</string> <string name="pref_autofill_apps_title">App and website settings</string>
<string name="pref_autofill_apps_hint">Customize autofill settings for specific apps.</string> <string name="pref_autofill_apps_hint">Customize autofill settings for specific apps.</string>
<string name="pref_autofill_default_title">Automatically match by default</string> <string name="pref_autofill_default_title">Automatically match by default</string>
<string name="pref_autofill_default_hint">Default to \'Automatically match\' for apps without custom settings. Otherwise, \'Never match.\'</string> <string name="pref_autofill_default_hint">Default to \'Automatically match\' for apps without custom settings. Otherwise, \'Never match.\'</string>
<string name="pref_autofill_always_title">Always show dialog</string>
<string name="pref_clear_clipboard_title">Clear clipboard 20 times</string> <string name="pref_clear_clipboard_title">Clear clipboard 20 times</string>
<string name="pref_clear_clipboard_hint">Store nonsense in the clipboard 20 times instead of just once. Useful on Samsung phones that feature clipboard history.</string> <string name="pref_clear_clipboard_hint">Store nonsense in the clipboard 20 times instead of just once. Useful on Samsung phones that feature clipboard history.</string>

View file

@ -79,7 +79,6 @@
<Preference <Preference
android:dependency="autofill_enable" android:dependency="autofill_enable"
android:key="autofill_apps" android:key="autofill_apps"
android:summary="@string/pref_autofill_apps_hint"
android:title="@string/pref_autofill_apps_title"/> android:title="@string/pref_autofill_apps_title"/>
<CheckBoxPreference <CheckBoxPreference
android:dependency="autofill_enable" android:dependency="autofill_enable"
@ -87,6 +86,11 @@
android:key="autofill_default" android:key="autofill_default"
android:summary="@string/pref_autofill_default_hint" android:summary="@string/pref_autofill_default_hint"
android:title="@string/pref_autofill_default_title"/> android:title="@string/pref_autofill_default_title"/>
<CheckBoxPreference
android:dependency="autofill_enable"
android:defaultValue="false"
android:key="autofill_always"
android:title="@string/pref_autofill_always_title"/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="Misc"> <PreferenceCategory android:title="Misc">

View file

@ -22,7 +22,7 @@ allprojects {
ext { ext {
compileSdkVersion = 23 compileSdkVersion = 23
buildToolsVersion = "23.0.1" buildToolsVersion = "23.0.2"
} }
subprojects { subproject -> subprojects { subproject ->
afterEvaluate{ afterEvaluate{