diff options
author | Zeapo <mohamed@zenadi.com> | 2014-07-27 23:07:53 +0100 |
---|---|---|
committer | Zeapo <mohamed@zenadi.com> | 2014-07-27 23:07:53 +0100 |
commit | e9be4bf8d0c4441c0ddf1fe638bd1bb73402a104 (patch) | |
tree | 3d9caefab4c2d4065bb8e9576fc0ce292c448595 /app | |
parent | f738c7ee36c0798a96b39aaf57aabf1f1843d60f (diff) |
get absolute path to a file from the name so that we can read it.
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/PasswordRepository.java | 4 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/PasswordStore.java | 11 |
2 files changed, 14 insertions, 1 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordRepository.java b/app/src/main/java/com/zeapo/pwdstore/PasswordRepository.java index 75e65144..cdbcb3b0 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordRepository.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordRepository.java @@ -60,6 +60,10 @@ public class PasswordRepository { return mainPasswordMap; } + public static File getFile(String name) { + return new File(repository.getWorkTree() + "/" + name); + } + public static ArrayList<String> getFilesList(File path){ List<File> files = (List<File>) FileUtils.listFiles(path, new String[] {"gpg"}, true); ArrayList<String> filePaths = new ArrayList<String>(); diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java index 9e45b38a..8bbdcb4e 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java @@ -31,6 +31,7 @@ import java.io.File; import java.io.FileFilter; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.IOException; import java.util.Collection; import java.util.List; @@ -115,7 +116,15 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI /* If an item is clicked in the list of passwords, this will be triggered */ @Override public void onFragmentInteraction(String id) { - System.out.println(id + " Clicked"); + + try { + for (String l : (List<String>) FileUtils.readLines(PasswordRepository.getFile(id), null)) { + System.out.println(l); + } + } catch (IOException e) { + //TODO handle problems + e.printStackTrace(); + } } } |