Good evening I have a question, I try to make a small application that simulates the behavior of a file manager starting from a specific folder, my problem is that I can show the first folders but when I pick up the Click on an item I tried to access their children I do not Populate
@EFragment(R.layout.fragment_opcion_list)
public class OpcionesListFragment extends Fragment {
@Model
@Populate
List<Opciones_> opciones = listFiles(new File(Constants.BASE_DIR));
private ArrayList<Historico> historicos = new ArrayList<Historico>();
private File currentDir;
@Click
public void card(Opciones_ model) {
File file = model.getFile();
if (file == null) {
Historico he = historicos.remove(historicos.size() - 1);
if (he.dir != null) {
listFiles(he.dir);
} else {
listFiles(new File(Constants.BASE_DIR));
}
} else if (file.isDirectory()) {
Historico he = new Historico();
he.dir = currentDir;
he.title = model.getOpcion();
historicos.add(he);
listFiles(file);
}
}
public List<Opciones_> listFiles(File dir) {
opciones = new ArrayList<>();
File[] files;
files = dir.listFiles();
if (files != null) {
for (File file : files) {
Opciones_ opcion = new Opciones_();
opcion.setOpcion(file.getName());
opcion.setFile(file);
opciones.add(opcion);
}
}
$Populate(opciones);
return opciones;
}
}
This is my code, the idea is that when I press an item populate again the list with the new data but it does not change, I do not know if I'm missing something
Good evening I have a question, I try to make a small application that simulates the behavior of a file manager starting from a specific folder, my problem is that I can show the first folders but when I pick up the Click on an item I tried to access their children I do not Populate
@EFragment(R.layout.fragment_opcion_list) public class OpcionesListFragment extends Fragment {
}
This is my code, the idea is that when I press an item populate again the list with the new data but it does not change, I do not know if I'm missing something