Skip to content

Commit e372607

Browse files
committed
Update WhatsApp Folder Location.
bumped version to 4.6 Signed-off-by: GauthamAsir <[email protected]>
1 parent a28e886 commit e372607

File tree

8 files changed

+101
-81
lines changed

8 files changed

+101
-81
lines changed

.idea/compiler.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/dictionaries/Mellow.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ android {
1717
minSdkVersion 21
1818
targetSdkVersion 30
1919
versionCode 4
20-
versionName "4.5"
20+
versionName "4.6"
2121
Date date = new Date()
2222
String d = date.format('_ddMMYYYY')
2323
setProperty("archivesBaseName", "WhatsApp_Status_Downloader_v$versionName$d")

app/src/main/java/a/gautham/statusdownloader/Fragments/ImageFragment.java

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -77,58 +77,67 @@ private void getStatus() {
7777

7878
if (Common.STATUS_DIRECTORY.exists()) {
7979

80-
new Thread(() -> {
81-
File[] statusFiles;
82-
statusFiles = Common.STATUS_DIRECTORY.listFiles();
83-
imagesList.clear();
80+
execute(Common.STATUS_DIRECTORY);
8481

85-
if (statusFiles != null && statusFiles.length > 0) {
82+
} else if (Common.STATUS_DIRECTORY_NEW.exists()) {
8683

87-
Arrays.sort(statusFiles);
88-
for (File file : statusFiles) {
89-
Status status = new Status(file, file.getName(), file.getAbsolutePath());
84+
execute(Common.STATUS_DIRECTORY_NEW);
9085

91-
if (!status.isVideo() && status.getTitle().endsWith(".jpg")) {
92-
imagesList.add(status);
93-
}
86+
} else {
87+
messageTextView.setVisibility(View.VISIBLE);
88+
messageTextView.setText(R.string.cant_find_whatsapp_dir);
89+
Toast.makeText(getActivity(), getString(R.string.cant_find_whatsapp_dir), Toast.LENGTH_SHORT).show();
90+
swipeRefreshLayout.setRefreshing(false);
91+
}
9492

95-
}
93+
}
94+
95+
private void execute(File wAFolder) {
96+
new Thread(() -> {
97+
File[] statusFiles;
98+
statusFiles = wAFolder.listFiles();
99+
imagesList.clear();
96100

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

99-
if (imagesList.size() <= 0) {
100-
messageTextView.setVisibility(View.VISIBLE);
101-
messageTextView.setText(R.string.no_files_found);
102-
} else {
103-
messageTextView.setVisibility(View.GONE);
104-
messageTextView.setText("");
105-
}
103+
Arrays.sort(statusFiles);
104+
for (File file : statusFiles) {
105+
Status status = new Status(file, file.getName(), file.getAbsolutePath());
106106

107-
imageAdapter = new ImageAdapter(imagesList, container);
108-
recyclerView.setAdapter(imageAdapter);
109-
imageAdapter.notifyDataSetChanged();
110-
progressBar.setVisibility(View.GONE);
111-
});
107+
if (!status.isVideo() && status.getTitle().endsWith(".jpg")) {
108+
imagesList.add(status);
109+
}
110+
111+
}
112112

113-
} else {
113+
handler.post(() -> {
114114

115-
handler.post(() -> {
116-
progressBar.setVisibility(View.GONE);
115+
if (imagesList.size() <= 0) {
117116
messageTextView.setVisibility(View.VISIBLE);
118117
messageTextView.setText(R.string.no_files_found);
119-
Toast.makeText(getActivity(), getString(R.string.no_files_found), Toast.LENGTH_SHORT).show();
120-
});
118+
} else {
119+
messageTextView.setVisibility(View.GONE);
120+
messageTextView.setText("");
121+
}
121122

122-
}
123-
swipeRefreshLayout.setRefreshing(false);
124-
}).start();
123+
imageAdapter = new ImageAdapter(imagesList, container);
124+
recyclerView.setAdapter(imageAdapter);
125+
imageAdapter.notifyDataSetChanged();
126+
progressBar.setVisibility(View.GONE);
127+
});
125128

126-
} else {
127-
messageTextView.setVisibility(View.VISIBLE);
128-
messageTextView.setText(R.string.cant_find_whatsapp_dir);
129-
Toast.makeText(getActivity(), getString(R.string.cant_find_whatsapp_dir), Toast.LENGTH_SHORT).show();
130-
swipeRefreshLayout.setRefreshing(false);
131-
}
129+
} else {
130+
131+
handler.post(() -> {
132+
progressBar.setVisibility(View.GONE);
133+
messageTextView.setVisibility(View.VISIBLE);
134+
messageTextView.setText(R.string.no_files_found);
135+
Toast.makeText(getActivity(), getString(R.string.no_files_found), Toast.LENGTH_SHORT).show();
136+
});
132137

138+
}
139+
swipeRefreshLayout.setRefreshing(false);
140+
}).start();
133141
}
142+
134143
}

app/src/main/java/a/gautham/statusdownloader/Fragments/VideoFragment.java

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -77,58 +77,66 @@ private void getStatus() {
7777

7878
if (Common.STATUS_DIRECTORY.exists()) {
7979

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

84-
if (statusFiles != null && statusFiles.length > 0) {
82+
} else if (Common.STATUS_DIRECTORY_NEW.exists()) {
8583

86-
Arrays.sort(statusFiles);
87-
for (File file : statusFiles) {
88-
Status status = new Status(file, file.getName(), file.getAbsolutePath());
84+
execute(Common.STATUS_DIRECTORY_NEW);
8985

90-
if (status.isVideo()) {
91-
videoList.add(status);
92-
}
86+
} else {
87+
messageTextView.setVisibility(View.VISIBLE);
88+
messageTextView.setText(R.string.cant_find_whatsapp_dir);
89+
Toast.makeText(getActivity(), getString(R.string.cant_find_whatsapp_dir), Toast.LENGTH_SHORT).show();
90+
swipeRefreshLayout.setRefreshing(false);
91+
}
9392

94-
}
93+
}
94+
95+
private void execute(File waFolder) {
96+
new Thread(() -> {
97+
File[] statusFiles = waFolder.listFiles();
98+
videoList.clear();
9599

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

98-
if (videoList.size() <= 0) {
99-
messageTextView.setVisibility(View.VISIBLE);
100-
messageTextView.setText(R.string.no_files_found);
101-
} else {
102-
messageTextView.setVisibility(View.GONE);
103-
messageTextView.setText("");
104-
}
102+
Arrays.sort(statusFiles);
103+
for (File file : statusFiles) {
104+
Status status = new Status(file, file.getName(), file.getAbsolutePath());
105+
106+
if (status.isVideo()) {
107+
videoList.add(status);
108+
}
105109

106-
videoAdapter = new VideoAdapter(videoList, container);
107-
recyclerView.setAdapter(videoAdapter);
108-
videoAdapter.notifyDataSetChanged();
109-
progressBar.setVisibility(View.GONE);
110-
});
110+
}
111111

112-
} else {
112+
handler.post(() -> {
113113

114-
handler.post(() -> {
115-
progressBar.setVisibility(View.GONE);
114+
if (videoList.size() <= 0) {
116115
messageTextView.setVisibility(View.VISIBLE);
117116
messageTextView.setText(R.string.no_files_found);
118-
Toast.makeText(getActivity(), getString(R.string.no_files_found), Toast.LENGTH_SHORT).show();
119-
});
117+
} else {
118+
messageTextView.setVisibility(View.GONE);
119+
messageTextView.setText("");
120+
}
120121

121-
}
122-
swipeRefreshLayout.setRefreshing(false);
123-
}).start();
122+
videoAdapter = new VideoAdapter(videoList, container);
123+
recyclerView.setAdapter(videoAdapter);
124+
videoAdapter.notifyDataSetChanged();
125+
progressBar.setVisibility(View.GONE);
126+
});
124127

125-
} else {
126-
messageTextView.setVisibility(View.VISIBLE);
127-
messageTextView.setText(R.string.cant_find_whatsapp_dir);
128-
Toast.makeText(getActivity(), getString(R.string.cant_find_whatsapp_dir), Toast.LENGTH_SHORT).show();
129-
swipeRefreshLayout.setRefreshing(false);
130-
}
128+
} else {
131129

130+
handler.post(() -> {
131+
progressBar.setVisibility(View.GONE);
132+
messageTextView.setVisibility(View.VISIBLE);
133+
messageTextView.setText(R.string.no_files_found);
134+
Toast.makeText(getActivity(), getString(R.string.no_files_found), Toast.LENGTH_SHORT).show();
135+
});
136+
137+
}
138+
swipeRefreshLayout.setRefreshing(false);
139+
}).start();
132140
}
133141

134142
}

app/src/main/java/a/gautham/statusdownloader/Utils/Common.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public class Common {
4040
public static final File STATUS_DIRECTORY = new File(Environment.getExternalStorageDirectory() +
4141
File.separator + "WhatsApp/Media/.Statuses");
4242

43+
public static final File STATUS_DIRECTORY_NEW = new File(Environment.getExternalStorageDirectory() +
44+
File.separator + "Android/media/com.whatsapp/WhatsApp/Media/.Statuses");
45+
4346
public static String APP_DIR;
4447

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

0 commit comments

Comments
 (0)