Skip to content

Commit

Permalink
fix list view visiblity and remove useless TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
Praharsh Jain committed Apr 25, 2022
1 parent 9dcfbba commit 80c3d8b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions app/src/main/java/com/praharsh/vudit/FileViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public class FileViewer extends AppCompatActivity
private EfficientAdapter adap;
private FileFilter fileFilter;
private Intent in;
private TextView current_duration, total_duration, title;
private TextView current_duration, total_duration, title, emptyListView;
private ImageButton btn_play, btn_rev, btn_forward;
private SeekBar seek;
private byte[] data;
Expand Down Expand Up @@ -210,7 +210,7 @@ private static String getFilePermissions(File file) {
String s = "";
if (file.getParent() != null) {
try {
ProcessBuilder processBuilder = new ProcessBuilder("ls", "-l").directory(new File(file.getParent()));// TODO CHECK IF THE FILE IS SD CARD PARENT IS NULL
ProcessBuilder processBuilder = new ProcessBuilder("ls", "-l").directory(new File(file.getParent()));
Process process = processBuilder.start();
PrintWriter out = new PrintWriter(new OutputStreamWriter(process.getOutputStream()));
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
Expand Down Expand Up @@ -278,7 +278,8 @@ protected void onCreate(Bundle savedInstanceState) {
navigationView.setNavigationItemSelectedListener(this);
lv = findViewById(R.id.list);
registerForContextMenu(lv);
lv.setEmptyView(findViewById(R.id.empty));
emptyListView=findViewById(R.id.empty);
lv.setEmptyView(emptyListView);
lv.setOnItemClickListener((adapterView, view, i, l) -> openFile(files[i]));
homeViewLayout = findViewById(R.id.home_view);
homeViewLayout.findViewById(R.id.btn_image_files).setOnClickListener(view -> listMediaFiles(1));
Expand Down Expand Up @@ -409,16 +410,10 @@ else if (homeView)
switchToHomeView();
else if (file != null)
updateFiles(file);
else
//Todo: something here
;
break;
case R.id.action_info:
if (file != null)
showProperties(file);
else
//Todo: something here
;
break;
}
return super.onOptionsItemSelected(item);
Expand Down Expand Up @@ -1137,6 +1132,7 @@ private void favouriteFiles() {
private void updateList() {
homeView = false;
lv.setVisibility(View.VISIBLE);
emptyListView.setVisibility(View.VISIBLE);
homeViewLayout.setVisibility(View.GONE);
if (adap != null) {
adap.notifyDataSetChanged();
Expand Down Expand Up @@ -1467,9 +1463,12 @@ private void requestSDCardPermissions(String cardPath) {

private void switchToHomeView() {
homeView = true;
recentsView=false;
favouritesView=false;
toolbar.setTitle("Vudit");
homeViewLayout.setVisibility(View.VISIBLE);
lv.setVisibility(View.GONE);
emptyListView.setVisibility(View.GONE);
}

private static class ViewHolder {
Expand Down

0 comments on commit 80c3d8b

Please sign in to comment.