shubham16g / SimpleWallpaperApp-Android

A simple demo wallpaper app which contains wallpaper links (json file) in assets folder.
25 stars 10 forks source link

Simple features #11

Closed LinkStatu closed 1 year ago

LinkStatu commented 1 year ago

Hi there, I hope you doing well. I suggest adding these features to the app to make it more interacting and suitable to the user: 1- Randomizing or shuffling the wallpapers at home page to increase the chances of showing the user as much of wallpapers as possible. And to do that I suggest one of these methods:

For me, I prefer the second one as "swipe to refresh" may cause app crash.

2- Making the wallpapers database online updated (by merging "wallpapers.json" and "categories.json" into one "content.json" or whatever name). To do that, the simplest way imo, is by implementing firebase Realtime database, hence my third suggestion comes:

3- implementing firebase messaging to send users simple messages once new wallpapers or categories would be added.

I think by adding 2 & 3 features, no need to update the app every time new wallpapers would be added to the .json file.

KamehamehaCoder commented 1 year ago

would be much better to fetch the original image instead of compression the image before it loads into the app or you download it. i tried making some changes like " if (stream == null) return false; bm.compress(Bitmap.CompressFormat.PNG, 100, stream); return true;"

this fetches the half the quality of original image at some extent

KamehamehaCoder commented 1 year ago

Here's the code for Asynchronous wallpaper set option

for set_layout_on.xml

<Button android:id="@+id/set_with_btn" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:background="@drawable/btn_primary" android:text="@string/set_with" />

and for the java code in WallpaperActivity

private void askOrApplyWallpaper() { View v = getLayoutInflater().inflate(R.layout.layout_set_on, null); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { AlertDialog dialog = new AlertDialog.Builder(WallpaperActivity.this) .setView(v).create(); v.findViewById(R.id.on_home_screen_btn).setOnClickListener(view -> { dialog.dismiss(); applyWallpaper(1); }); v.findViewById(R.id.on_lock_screen_btn).setOnClickListener(view -> { dialog.dismiss(); applyWallpaper(2); }); v.findViewById(R.id.on_both_screen_btn).setOnClickListener(view -> { dialog.dismiss(); applyWallpaper(3); }); v.findViewById(R.id.set_with_btn).setOnClickListener(view -> { dialog.dismiss(); applyWallpaperAsync(1); }); dialog.show(); } else { applyWallpaper(0); } }

and finally you would need to create the methods for applyWallpaperAsync and applyAsync and you are good to go with the Asynchronous Wallpaper option.

Also you would have to replace the null argument passed to apply with callback in the doInBackground method of applyAsync, so that the apply method can actually call the callback when it completes.