Skip to content

Commit

Permalink
bug fixes.
Browse files Browse the repository at this point in the history
Show message when no files found.
bumped version to 4.5

Signed-off-by: GauthamAsir <[email protected]>
  • Loading branch information
GauthamAsir committed Apr 4, 2021
1 parent 8c19465 commit a28e886
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 14 deletions.
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.4"
versionName "4.5"
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 @@ -8,6 +8,7 @@
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -37,6 +38,7 @@ public class ImageFragment extends Fragment {
private ImageAdapter imageAdapter;
private RelativeLayout container;
private SwipeRefreshLayout swipeRefreshLayout;
private TextView messageTextView;

@Nullable
@Override
Expand All @@ -52,6 +54,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
progressBar = view.findViewById(R.id.prgressBarImage);
container = view.findViewById(R.id.image_container);
swipeRefreshLayout = view.findViewById(R.id.swipeRefreshLayout);
messageTextView = view.findViewById(R.id.messageTextImage);

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

handler.post(() -> {

if (imagesList.size() <= 0) {
messageTextView.setVisibility(View.VISIBLE);
messageTextView.setText(R.string.no_files_found);
} else {
messageTextView.setVisibility(View.GONE);
messageTextView.setText("");
}

imageAdapter = new ImageAdapter(imagesList, container);
recyclerView.setAdapter(imageAdapter);
imageAdapter.notifyDataSetChanged();
Expand All @@ -103,15 +114,19 @@ private void getStatus() {

handler.post(() -> {
progressBar.setVisibility(View.GONE);
Toast.makeText(getActivity(), "Dir doest not exists", Toast.LENGTH_SHORT).show();
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();

} else {
Toast.makeText(getActivity(), "Cant find WhatsApp Dir", Toast.LENGTH_SHORT).show();
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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -37,6 +38,7 @@ public class VideoFragment extends Fragment {
private VideoAdapter videoAdapter;
private RelativeLayout container;
private SwipeRefreshLayout swipeRefreshLayout;
private TextView messageTextView;

@Nullable
@Override
Expand All @@ -51,6 +53,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
progressBar = view.findViewById(R.id.prgressBarVideo);
container = view.findViewById(R.id.videos_container);
swipeRefreshLayout = view.findViewById(R.id.swipeRefreshLayout);
messageTextView = view.findViewById(R.id.messageTextVideo);

StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());
Expand Down Expand Up @@ -91,6 +94,15 @@ private void getStatus() {
}

handler.post(() -> {

if (videoList.size() <= 0) {
messageTextView.setVisibility(View.VISIBLE);
messageTextView.setText(R.string.no_files_found);
} else {
messageTextView.setVisibility(View.GONE);
messageTextView.setText("");
}

videoAdapter = new VideoAdapter(videoList, container);
recyclerView.setAdapter(videoAdapter);
videoAdapter.notifyDataSetChanged();
Expand All @@ -101,23 +113,22 @@ private void getStatus() {

handler.post(() -> {
progressBar.setVisibility(View.GONE);
Toast.makeText(getActivity(), "Dir doest not exists", Toast.LENGTH_SHORT).show();
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();

} else {
Toast.makeText(getActivity(), "Cant find WhatsApp Dir", Toast.LENGTH_SHORT).show();
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 Bitmap getThumbnail(Status status) {
// return a.gautham.statusdownloader.Utils.ThumbnailUtils.createVideoThumbnail(status.getFile().getAbsolutePath(),
// 3);
// }

}
13 changes: 11 additions & 2 deletions app/src/main/res/layout/fragment_images.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,22 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewImage"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent" />

<ProgressBar
android:id="@+id/prgressBarImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
android:layout_centerInParent="true" />

<TextView
android:id="@+id/messageTextImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:textAppearance="?android:textAppearanceLarge"
android:visibility="gone" />

</RelativeLayout>

Expand Down
13 changes: 11 additions & 2 deletions app/src/main/res/layout/fragment_videos.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,22 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewVideo"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent" />

<ProgressBar
android:id="@+id/prgressBarVideo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
android:layout_centerInParent="true" />

<TextView
android:id="@+id/messageTextVideo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:textAppearance="?android:textAppearanceLarge"
android:visibility="gone" />

</RelativeLayout>

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@
<string name="telegram_link">https://t.me/Mellow04</string>
<string name="developer">Developer</string>
<string name="check_for_update">Check for update</string>
<string name="cant_find_whatsapp_dir">Cant find WhatsApp Dir</string>

</resources>

0 comments on commit a28e886

Please sign in to comment.