Skip to content

Commit a28e886

Browse files
committed
bug fixes.
Show message when no files found. bumped version to 4.5 Signed-off-by: GauthamAsir <[email protected]>
1 parent 8c19465 commit a28e886

File tree

6 files changed

+59
-14
lines changed

6 files changed

+59
-14
lines changed

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.4"
20+
versionName "4.5"
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: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.view.ViewGroup;
99
import android.widget.ProgressBar;
1010
import android.widget.RelativeLayout;
11+
import android.widget.TextView;
1112
import android.widget.Toast;
1213

1314
import androidx.annotation.NonNull;
@@ -37,6 +38,7 @@ public class ImageFragment extends Fragment {
3738
private ImageAdapter imageAdapter;
3839
private RelativeLayout container;
3940
private SwipeRefreshLayout swipeRefreshLayout;
41+
private TextView messageTextView;
4042

4143
@Nullable
4244
@Override
@@ -52,6 +54,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
5254
progressBar = view.findViewById(R.id.prgressBarImage);
5355
container = view.findViewById(R.id.image_container);
5456
swipeRefreshLayout = view.findViewById(R.id.swipeRefreshLayout);
57+
messageTextView = view.findViewById(R.id.messageTextImage);
5558

5659
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
5760
StrictMode.setVmPolicy(builder.build());
@@ -93,6 +96,14 @@ private void getStatus() {
9396

9497
handler.post(() -> {
9598

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+
}
106+
96107
imageAdapter = new ImageAdapter(imagesList, container);
97108
recyclerView.setAdapter(imageAdapter);
98109
imageAdapter.notifyDataSetChanged();
@@ -103,15 +114,19 @@ private void getStatus() {
103114

104115
handler.post(() -> {
105116
progressBar.setVisibility(View.GONE);
106-
Toast.makeText(getActivity(), "Dir doest not exists", Toast.LENGTH_SHORT).show();
117+
messageTextView.setVisibility(View.VISIBLE);
118+
messageTextView.setText(R.string.no_files_found);
119+
Toast.makeText(getActivity(), getString(R.string.no_files_found), Toast.LENGTH_SHORT).show();
107120
});
108121

109122
}
110123
swipeRefreshLayout.setRefreshing(false);
111124
}).start();
112125

113126
} else {
114-
Toast.makeText(getActivity(), "Cant find WhatsApp Dir", Toast.LENGTH_SHORT).show();
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();
115130
swipeRefreshLayout.setRefreshing(false);
116131
}
117132

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

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.view.ViewGroup;
99
import android.widget.ProgressBar;
1010
import android.widget.RelativeLayout;
11+
import android.widget.TextView;
1112
import android.widget.Toast;
1213

1314
import androidx.annotation.NonNull;
@@ -37,6 +38,7 @@ public class VideoFragment extends Fragment {
3738
private VideoAdapter videoAdapter;
3839
private RelativeLayout container;
3940
private SwipeRefreshLayout swipeRefreshLayout;
41+
private TextView messageTextView;
4042

4143
@Nullable
4244
@Override
@@ -51,6 +53,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
5153
progressBar = view.findViewById(R.id.prgressBarVideo);
5254
container = view.findViewById(R.id.videos_container);
5355
swipeRefreshLayout = view.findViewById(R.id.swipeRefreshLayout);
56+
messageTextView = view.findViewById(R.id.messageTextVideo);
5457

5558
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
5659
StrictMode.setVmPolicy(builder.build());
@@ -91,6 +94,15 @@ private void getStatus() {
9194
}
9295

9396
handler.post(() -> {
97+
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+
}
105+
94106
videoAdapter = new VideoAdapter(videoList, container);
95107
recyclerView.setAdapter(videoAdapter);
96108
videoAdapter.notifyDataSetChanged();
@@ -101,23 +113,22 @@ private void getStatus() {
101113

102114
handler.post(() -> {
103115
progressBar.setVisibility(View.GONE);
104-
Toast.makeText(getActivity(), "Dir doest not exists", Toast.LENGTH_SHORT).show();
116+
messageTextView.setVisibility(View.VISIBLE);
117+
messageTextView.setText(R.string.no_files_found);
118+
Toast.makeText(getActivity(), getString(R.string.no_files_found), Toast.LENGTH_SHORT).show();
105119
});
106120

107121
}
108122
swipeRefreshLayout.setRefreshing(false);
109123
}).start();
110124

111125
} else {
112-
Toast.makeText(getActivity(), "Cant find WhatsApp Dir", Toast.LENGTH_SHORT).show();
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();
113129
swipeRefreshLayout.setRefreshing(false);
114130
}
115131

116132
}
117133

118-
// private Bitmap getThumbnail(Status status) {
119-
// return a.gautham.statusdownloader.Utils.ThumbnailUtils.createVideoThumbnail(status.getFile().getAbsolutePath(),
120-
// 3);
121-
// }
122-
123134
}

app/src/main/res/layout/fragment_images.xml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,22 @@
1313
<androidx.recyclerview.widget.RecyclerView
1414
android:id="@+id/recyclerViewImage"
1515
android:layout_width="match_parent"
16-
android:layout_height="match_parent"/>
16+
android:layout_height="match_parent" />
1717

1818
<ProgressBar
1919
android:id="@+id/prgressBarImage"
2020
android:layout_width="wrap_content"
2121
android:layout_height="wrap_content"
22-
android:layout_centerInParent="true"/>
22+
android:layout_centerInParent="true" />
23+
24+
<TextView
25+
android:id="@+id/messageTextImage"
26+
android:layout_width="match_parent"
27+
android:layout_height="wrap_content"
28+
android:layout_centerInParent="true"
29+
android:gravity="center"
30+
android:textAppearance="?android:textAppearanceLarge"
31+
android:visibility="gone" />
2332

2433
</RelativeLayout>
2534

app/src/main/res/layout/fragment_videos.xml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,22 @@
1313
<androidx.recyclerview.widget.RecyclerView
1414
android:id="@+id/recyclerViewVideo"
1515
android:layout_width="match_parent"
16-
android:layout_height="match_parent"/>
16+
android:layout_height="match_parent" />
1717

1818
<ProgressBar
1919
android:id="@+id/prgressBarVideo"
2020
android:layout_width="wrap_content"
2121
android:layout_height="wrap_content"
22-
android:layout_centerInParent="true"/>
22+
android:layout_centerInParent="true" />
23+
24+
<TextView
25+
android:id="@+id/messageTextVideo"
26+
android:layout_width="match_parent"
27+
android:layout_height="wrap_content"
28+
android:layout_centerInParent="true"
29+
android:gravity="center"
30+
android:textAppearance="?android:textAppearanceLarge"
31+
android:visibility="gone" />
2332

2433
</RelativeLayout>
2534

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@
3838
<string name="telegram_link">https://t.me/Mellow04</string>
3939
<string name="developer">Developer</string>
4040
<string name="check_for_update">Check for update</string>
41+
<string name="cant_find_whatsapp_dir">Cant find WhatsApp Dir</string>
4142

4243
</resources>

0 commit comments

Comments
 (0)