get absolute path to a file from the name so that we can read it.
This commit is contained in:
parent
f738c7ee36
commit
e9be4bf8d0
2 changed files with 14 additions and 1 deletions
|
@ -60,6 +60,10 @@ public class PasswordRepository {
|
||||||
return mainPasswordMap;
|
return mainPasswordMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static File getFile(String name) {
|
||||||
|
return new File(repository.getWorkTree() + "/" + name);
|
||||||
|
}
|
||||||
|
|
||||||
public static ArrayList<String> getFilesList(File path){
|
public static ArrayList<String> getFilesList(File path){
|
||||||
List<File> files = (List<File>) FileUtils.listFiles(path, new String[] {"gpg"}, true);
|
List<File> files = (List<File>) FileUtils.listFiles(path, new String[] {"gpg"}, true);
|
||||||
ArrayList<String> filePaths = new ArrayList<String>();
|
ArrayList<String> filePaths = new ArrayList<String>();
|
||||||
|
|
|
@ -31,6 +31,7 @@ import java.io.File;
|
||||||
import java.io.FileFilter;
|
import java.io.FileFilter;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
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 */
|
/* If an item is clicked in the list of passwords, this will be triggered */
|
||||||
@Override
|
@Override
|
||||||
public void onFragmentInteraction(String id) {
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue