Skip to content

Commit

Permalink
Update WhatsApp Folder Location.
Browse files Browse the repository at this point in the history
bumped version to 4.6

Signed-off-by: GauthamAsir <gauthamnadar12@gmail.com>
  • Loading branch information
GauthamAsir committed Jun 4, 2021
1 parent a28e886 commit e372607
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/dictionaries/Mellow.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ android {
minSdkVersion 21
targetSdkVersion 30
versionCode 4
versionName "4.5"
versionName "4.6"
Date date = new Date()
String d = date.format('_ddMMYYYY')
setProperty("archivesBaseName", "WhatsApp_Status_Downloader_v$versionName$d")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,58 +77,67 @@ private void getStatus() {

if (Common.STATUS_DIRECTORY.exists()) {

new Thread(() -> {
File[] statusFiles;
statusFiles = Common.STATUS_DIRECTORY.listFiles();
imagesList.clear();
execute(Common.STATUS_DIRECTORY);

if (statusFiles != null && statusFiles.length > 0) {
} else if (Common.STATUS_DIRECTORY_NEW.exists()) {

Arrays.sort(statusFiles);
for (File file : statusFiles) {
Status status = new Status(file, file.getName(), file.getAbsolutePath());
execute(Common.STATUS_DIRECTORY_NEW);

if (!status.isVideo() && status.getTitle().endsWith(".jpg")) {
imagesList.add(status);
}
} else {
messageTextView.setVisibility(View.VISIBLE);
messageTextView.setText(R.string.cant_find_whatsapp_dir);
Toast.makeText(getActivity(), getString(R.string.cant_find_whatsapp_dir), Toast.LENGTH_SHORT).show();
swipeRefreshLayout.setRefreshing(false);
}

}
}

private void execute(File wAFolder) {
new Thread(() -> {
File[] statusFiles;
statusFiles = wAFolder.listFiles();
imagesList.clear();

handler.post(() -> {
if (statusFiles != null && statusFiles.length > 0) {

if (imagesList.size() <= 0) {
messageTextView.setVisibility(View.VISIBLE);
messageTextView.setText(R.string.no_files_found);
} else {
messageTextView.setVisibility(View.GONE);
messageTextView.setText("");
}
Arrays.sort(statusFiles);
for (File file : statusFiles) {
Status status = new Status(file, file.getName(), file.getAbsolutePath());

imageAdapter = new ImageAdapter(imagesList, container);
recyclerView.setAdapter(imageAdapter);
imageAdapter.notifyDataSetChanged();
progressBar.setVisibility(View.GONE);
});
if (!status.isVideo() && status.getTitle().endsWith(".jpg")) {
imagesList.add(status);
}

}

} else {
handler.post(() -> {

handler.post(() -> {
progressBar.setVisibility(View.GONE);
if (imagesList.size() <= 0) {
messageTextView.setVisibility(View.VISIBLE);
messageTextView.setText(R.string.no_files_found);
Toast.makeText(getActivity(), getString(R.string.no_files_found), Toast.LENGTH_SHORT).show();
});
} else {
messageTextView.setVisibility(View.GONE);
messageTextView.setText("");
}

}
swipeRefreshLayout.setRefreshing(false);
}).start();
imageAdapter = new ImageAdapter(imagesList, container);
recyclerView.setAdapter(imageAdapter);
imageAdapter.notifyDataSetChanged();
progressBar.setVisibility(View.GONE);
});

} else {
messageTextView.setVisibility(View.VISIBLE);
messageTextView.setText(R.string.cant_find_whatsapp_dir);
Toast.makeText(getActivity(), getString(R.string.cant_find_whatsapp_dir), Toast.LENGTH_SHORT).show();
swipeRefreshLayout.setRefreshing(false);
}
} else {

handler.post(() -> {
progressBar.setVisibility(View.GONE);
messageTextView.setVisibility(View.VISIBLE);
messageTextView.setText(R.string.no_files_found);
Toast.makeText(getActivity(), getString(R.string.no_files_found), Toast.LENGTH_SHORT).show();
});

}
swipeRefreshLayout.setRefreshing(false);
}).start();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -77,58 +77,66 @@ private void getStatus() {

if (Common.STATUS_DIRECTORY.exists()) {

new Thread(() -> {
File[] statusFiles = Common.STATUS_DIRECTORY.listFiles();
videoList.clear();
execute(Common.STATUS_DIRECTORY);

if (statusFiles != null && statusFiles.length > 0) {
} else if (Common.STATUS_DIRECTORY_NEW.exists()) {

Arrays.sort(statusFiles);
for (File file : statusFiles) {
Status status = new Status(file, file.getName(), file.getAbsolutePath());
execute(Common.STATUS_DIRECTORY_NEW);

if (status.isVideo()) {
videoList.add(status);
}
} else {
messageTextView.setVisibility(View.VISIBLE);
messageTextView.setText(R.string.cant_find_whatsapp_dir);
Toast.makeText(getActivity(), getString(R.string.cant_find_whatsapp_dir), Toast.LENGTH_SHORT).show();
swipeRefreshLayout.setRefreshing(false);
}

}
}

private void execute(File waFolder) {
new Thread(() -> {
File[] statusFiles = waFolder.listFiles();
videoList.clear();

handler.post(() -> {
if (statusFiles != null && statusFiles.length > 0) {

if (videoList.size() <= 0) {
messageTextView.setVisibility(View.VISIBLE);
messageTextView.setText(R.string.no_files_found);
} else {
messageTextView.setVisibility(View.GONE);
messageTextView.setText("");
}
Arrays.sort(statusFiles);
for (File file : statusFiles) {
Status status = new Status(file, file.getName(), file.getAbsolutePath());

if (status.isVideo()) {
videoList.add(status);
}

videoAdapter = new VideoAdapter(videoList, container);
recyclerView.setAdapter(videoAdapter);
videoAdapter.notifyDataSetChanged();
progressBar.setVisibility(View.GONE);
});
}

} else {
handler.post(() -> {

handler.post(() -> {
progressBar.setVisibility(View.GONE);
if (videoList.size() <= 0) {
messageTextView.setVisibility(View.VISIBLE);
messageTextView.setText(R.string.no_files_found);
Toast.makeText(getActivity(), getString(R.string.no_files_found), Toast.LENGTH_SHORT).show();
});
} else {
messageTextView.setVisibility(View.GONE);
messageTextView.setText("");
}

}
swipeRefreshLayout.setRefreshing(false);
}).start();
videoAdapter = new VideoAdapter(videoList, container);
recyclerView.setAdapter(videoAdapter);
videoAdapter.notifyDataSetChanged();
progressBar.setVisibility(View.GONE);
});

} else {
messageTextView.setVisibility(View.VISIBLE);
messageTextView.setText(R.string.cant_find_whatsapp_dir);
Toast.makeText(getActivity(), getString(R.string.cant_find_whatsapp_dir), Toast.LENGTH_SHORT).show();
swipeRefreshLayout.setRefreshing(false);
}
} else {

handler.post(() -> {
progressBar.setVisibility(View.GONE);
messageTextView.setVisibility(View.VISIBLE);
messageTextView.setText(R.string.no_files_found);
Toast.makeText(getActivity(), getString(R.string.no_files_found), Toast.LENGTH_SHORT).show();
});

}
swipeRefreshLayout.setRefreshing(false);
}).start();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public class Common {
public static final File STATUS_DIRECTORY = new File(Environment.getExternalStorageDirectory() +
File.separator + "WhatsApp/Media/.Statuses");

public static final File STATUS_DIRECTORY_NEW = new File(Environment.getExternalStorageDirectory() +
File.separator + "Android/media/com.whatsapp/WhatsApp/Media/.Statuses");

public static String APP_DIR;

public static void copyFile(Status status, Context context, RelativeLayout container) {
Expand Down

0 comments on commit e372607

Please sign in to comment.