mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-09-04 16:25:15 +00:00
passwordfragment changes
This commit is contained in:
@@ -111,10 +111,14 @@ public class PasswordFragment extends Fragment{
|
|||||||
recyclerAdapter.addAll(PasswordRepository.getPasswords(item.getFile(), PasswordRepository.getRepositoryDirectory(activity)));
|
recyclerAdapter.addAll(PasswordRepository.getPasswords(item.getFile(), PasswordRepository.getRepositoryDirectory(activity)));
|
||||||
|
|
||||||
((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
} else {
|
||||||
|
if (getArguments().getBoolean("matchWith", false)) {
|
||||||
|
((PasswordStore) getActivity()).matchPasswordWithApp(item);
|
||||||
} else {
|
} else {
|
||||||
((PasswordStore) getActivity()).decryptPassword(item);
|
((PasswordStore) getActivity()).decryptPassword(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void savePosition(Integer position) {
|
public void savePosition(Integer position) {
|
||||||
|
|
||||||
|
@@ -289,6 +289,12 @@ public class PasswordStore extends AppCompatActivity {
|
|||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putString("Path", PasswordRepository.getWorkTree().getAbsolutePath());
|
args.putString("Path", PasswordRepository.getWorkTree().getAbsolutePath());
|
||||||
|
|
||||||
|
// if the activity was started from the autofill settings, the
|
||||||
|
// intent is to match a clicked pwd with app. pass this to fragment
|
||||||
|
if (getIntent().getBooleanExtra("matchWith", false)) {
|
||||||
|
args.putBoolean("matchWith", true);
|
||||||
|
}
|
||||||
|
|
||||||
plist.setArguments(args);
|
plist.setArguments(args);
|
||||||
|
|
||||||
fragmentTransaction.addToBackStack("passlist");
|
fragmentTransaction.addToBackStack("passlist");
|
||||||
@@ -531,4 +537,13 @@ public class PasswordStore extends AppCompatActivity {
|
|||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void matchPasswordWithApp(PasswordItem item) {
|
||||||
|
String path = item.getFile().getAbsolutePath();
|
||||||
|
path = path.replace(PasswordRepository.getWorkTree() + "/", "").replace(".gpg", "");
|
||||||
|
Intent data = new Intent();
|
||||||
|
data.putExtra("path", path);
|
||||||
|
setResult(RESULT_OK, data);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.zeapo.pwdstore.autofill;
|
package com.zeapo.pwdstore.autofill;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
@@ -18,6 +19,7 @@ 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 {
|
||||||
|
private static final int MATCH_WITH = 777;
|
||||||
|
|
||||||
public AutofillFragment() {
|
public AutofillFragment() {
|
||||||
}
|
}
|
||||||
@@ -57,7 +59,8 @@ public class AutofillFragment extends DialogFragment {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
// TODO figure out UI for this
|
// TODO figure out UI for this
|
||||||
Intent intent = new Intent(getActivity(), PasswordStore.class);
|
Intent intent = new Intent(getActivity(), PasswordStore.class);
|
||||||
startActivity(intent);
|
intent.putExtra("matchWith", true);
|
||||||
|
startActivityForResult(intent, MATCH_WITH);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
view.findViewById(R.id.match).setOnClickListener(matchPassword);
|
view.findViewById(R.id.match).setOnClickListener(matchPassword);
|
||||||
@@ -92,4 +95,12 @@ public class AutofillFragment extends DialogFragment {
|
|||||||
builder.setNegativeButton("Cancel", null);
|
builder.setNegativeButton("Cancel", null);
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
|
((EditText) getDialog().findViewById(R.id.matched)).setText(data.getStringExtra("path"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,9 @@
|
|||||||
package com.zeapo.pwdstore.autofill;
|
package com.zeapo.pwdstore.autofill;
|
||||||
|
|
||||||
import android.app.DialogFragment;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@@ -75,7 +75,7 @@
|
|||||||
<Preference
|
<Preference
|
||||||
android:key="autofill_apps"
|
android:key="autofill_apps"
|
||||||
android:summary="Customize autofill settings for specific apps."
|
android:summary="Customize autofill settings for specific apps."
|
||||||
android:title="Autofill Apps"/>
|
android:title="Per-app settings"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="Misc">
|
<PreferenceCategory android:title="Misc">
|
||||||
|
Reference in New Issue
Block a user