Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
568dffd
fixes #242
LiquidatorCoder Oct 28, 2021
63a9b09
Merge pull request #245 from Hash-Studios/update-dep
codenameakshay Dec 1, 2021
f998601
fix dependencies
codenameakshay Dec 1, 2021
9aee734
dart fix apply
codenameakshay Dec 1, 2021
2b45ba7
update dependencies
codenameakshay Dec 2, 2021
7174f68
update gradle and compileSDKVersion
codenameakshay Dec 2, 2021
316d572
add new download and set wallpaper buttons
codenameakshay Dec 2, 2021
d1b5e42
add permission check in downloads
codenameakshay Dec 2, 2021
8573dc0
fix infos
codenameakshay Dec 2, 2021
988caf9
fix wallpaperScreen unused code
codenameakshay Dec 2, 2021
35ec653
add new download/set in fav wall view screen
codenameakshay Dec 2, 2021
2d4bff1
add new download/set in profile wall view screen
codenameakshay Dec 2, 2021
0e4b5f6
add new download/set in user profile wall view screen
codenameakshay Dec 2, 2021
c82b2ce
add new download/set in search wall view screen
codenameakshay Dec 2, 2021
4c78588
add new download/set in share wall view screen
codenameakshay Dec 2, 2021
b9ea07f
remove optimisedWallpaper bool
codenameakshay Dec 2, 2021
c0579c3
fix old download button
codenameakshay Dec 2, 2021
fbe2ec8
fix download button downloading twice
codenameakshay Dec 2, 2021
952255f
add amoled convert function #246
codenameakshay Dec 2, 2021
ca28ebd
update themes with colorscheme
LiquidatorCoder Dec 2, 2021
3da7bb6
Merge branch 'v2.7.0' of https://github.com/LiquidatorCoder/wallpaper…
LiquidatorCoder Dec 2, 2021
d170541
remove extra themes
LiquidatorCoder Dec 2, 2021
8610bb8
remove screenshot package
codenameakshay Dec 2, 2021
bb051dd
fix infos, remove unnecessary method channel
codenameakshay Dec 2, 2021
a37af29
fix wallpaper filter screen download/set wallpaper
codenameakshay Dec 2, 2021
a8b33e4
remove unused code from MainActivity.java
codenameakshay Dec 2, 2021
0260fc7
fixes theme issues
LiquidatorCoder Dec 2, 2021
8ab348b
Merge branch 'v2.7.0' of https://github.com/Hash-Studios/Prism into v…
codenameakshay Dec 2, 2021
a492c2f
add more search chips
LiquidatorCoder Dec 2, 2021
6f782e0
fixes app bar color in theme
LiquidatorCoder Dec 2, 2021
5655e45
fix appbar color in notifications page
LiquidatorCoder Dec 2, 2021
4f28663
update version to v2.7.0+78
LiquidatorCoder Dec 3, 2021
a23b092
fix android 12 error
codenameakshay Dec 26, 2021
2a875ce
add json annotation
codenameakshay Dec 26, 2021
df66cbf
fix extended image
codenameakshay Dec 26, 2021
a052ca4
fix callback error
codenameakshay Dec 26, 2021
e0ccb40
remove download button from focus menus
codenameakshay Dec 26, 2021
09d4d1d
update version to v2.7.0+79
codenameakshay Dec 26, 2021
4aa75dd
change ads not loading impression
codenameakshay Dec 26, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Changelog

### v2.7.0
- Temporarily removed themes for now
- Fix download and set wall bugs

### v2.6.9
- Laid support for Prism v3
- New model for users
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ You can also report bugs, upload your setups/walls on our telegram channel

Full changelog can be found [here](https://github.com/Hash-Studios/Prism/tree/master/CHANGELOG.md).

### v2.7.0
- Temporarily removed themes for now
- Fix download and set wall bugs

### v2.6.9
- Laid support for Prism v3
- New model for users
Expand Down
6 changes: 3 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
}

android {
compileSdkVersion 30
compileSdkVersion 31

lintOptions {
disable 'InvalidPackage'
Expand All @@ -40,8 +40,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.hash.prism"
minSdkVersion 19
targetSdkVersion 30
minSdkVersion 21
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
Expand Down
9 changes: 8 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hash.prism" >
package="com.hash.prism"
xmlns:tools="http://schemas.android.com/tools" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Expand All @@ -13,11 +14,13 @@
<application
android:name="io.flutter.app.FlutterApplication"
android:icon="@mipmap/ic_launcher"
tools:replace="android:name"
android:label="Prism" >
<service
android:name=".MyTileService"
android:icon="@drawable/preview_widget"
android:label="@string/quick_settings"
android:exported="true"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">

<intent-filter>
Expand All @@ -30,6 +33,7 @@
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:exported="true"
android:windowSoftInputMode="adjustResize" >
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
Expand Down Expand Up @@ -84,6 +88,9 @@
Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java
-->
<provider android:name="vn.hunghd.flutterdownloader.DownloadedFileProvider" android:authorities="${applicationId}.flutter_downloader.provider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
</provider>
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
Expand Down
268 changes: 2 additions & 266 deletions android/app/src/main/java/com/hash/Prism/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,71 +38,7 @@
public class MainActivity extends FlutterActivity {
private static final String CHANNEL = "flutter.prism.set_wallpaper";
public static MethodChannel.Result res;
private Target target = new Target() {
@Override
public void onBitmapLoaded(Bitmap resource, Picasso.LoadedFrom from) {
android.util.Log.i("Arguments ", "configureFlutterEngine: " + "Image Downloaded");
SetWallPaperTask setWallPaperTask = new SetWallPaperTask(getActivity());
setWallPaperTask.execute(new Pair(resource, "1"));
}

@Override
public void onBitmapFailed(Exception e, Drawable errorDrawable) {
}

@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
};
private Target target1 = new Target() {
@Override
public void onBitmapLoaded(Bitmap resource, Picasso.LoadedFrom from) {
android.util.Log.i("Arguments ", "configureFlutterEngine: " + "Image Downloaded");
SetWallPaperTask setWallPaperTask = new SetWallPaperTask(getActivity());
setWallPaperTask.execute(new Pair(resource, "2"));
}

@Override
public void onBitmapFailed(Exception e, Drawable errorDrawable) {
}

@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
};
private Target target2 = new Target() {
@Override
public void onBitmapLoaded(Bitmap resource, Picasso.LoadedFrom from) {
android.util.Log.i("Arguments ", "configureFlutterEngine: " + "Image Downloaded");
SetWallPaperTask setWallPaperTask = new SetWallPaperTask(getActivity());
setWallPaperTask.execute(new Pair(resource, "3"));
}

@Override
public void onBitmapFailed(Exception e, Drawable errorDrawable) {
}

@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
};
private Target target3 = new Target() {
@Override
public void onBitmapLoaded(Bitmap resource, Picasso.LoadedFrom from) {
android.util.Log.i("Arguments ", "configureFlutterEngine: " + "Image Downloaded");
SetWallPaperTask setWallPaperTask = new SetWallPaperTask(getActivity());
setWallPaperTask.execute(new Pair(resource, "4"));
}

@Override
public void onBitmapFailed(Exception e, Drawable errorDrawable) {
}

@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
};


Target saveImageTarget = new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
Expand Down Expand Up @@ -154,47 +90,7 @@ public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), CHANNEL)
.setMethodCallHandler((call, result) -> {
res = result;
if (call.method.equals("set_wallpaper")) {
String url = call.argument("url"); // .argument returns the correct type
android.util.Log.i("Arguments ", "configureFlutterEngine: " + url);
Picasso.get().load(url).into(target);

} else if (call.method.equals("set_wallpaper_file")) {
String url = call.argument("url"); // .argument returns the correct type
android.util.Log.i("Arguments ", "configureFlutterEngine: " + url);
Picasso.get().load("file://" + url).into(target);

} else if (call.method.equals("set_lock_wallpaper")) {
String url = call.argument("url"); // .argument returns the correct type
android.util.Log.i("Arguments ", "configureFlutterEngine: " + url);
Picasso.get().load(url).into(target1);

} else if (call.method.equals("set_home_wallpaper")) {
String url = call.argument("url"); // .argument returns the correct type
android.util.Log.i("Arguments ", "configureFlutterEngine: " + url);
Picasso.get().load(url).into(target2);

} else if (call.method.equals("set_both_wallpaper")) {
String url = call.argument("url"); // .argument returns the correct type
android.util.Log.i("Arguments ", "configureFlutterEngine: " + url);
Picasso.get().load(url).into(target3);

} else if (call.method.equals("set_lock_wallpaper_file")) {
String url = call.argument("url"); // .argument returns the correct type
android.util.Log.i("Arguments ", "configureFlutterEngine: " + url);
Picasso.get().load("file://" + url).into(target1);

} else if (call.method.equals("set_home_wallpaper_file")) {
String url = call.argument("url"); // .argument returns the correct type
android.util.Log.i("Arguments ", "configureFlutterEngine: " + url);
Picasso.get().load("file://" + url).into(target2);

} else if (call.method.equals("set_both_wallpaper_file")) {
String url = call.argument("url"); // .argument returns the correct type
android.util.Log.i("Arguments ", "configureFlutterEngine: " + url);
Picasso.get().load("file://" + url).into(target3);

} else if (call.method.equals("save_image")) {
if (call.method.equals("save_image")) {
String link = call.argument("link");
Picasso.get().load(link).into(saveImageTarget);
} else if (call.method.equals("save_image_file")) {
Expand All @@ -203,33 +99,10 @@ public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
} else if (call.method.equals("save_setup")) {
String link = call.argument("link");
Picasso.get().load(link).into(saveSetupTarget);
} else if (call.method.equals("download_image_dm")) {
String link = call.argument("link");
String filename = call.argument("filename");
downloadImageNew(filename,link);
}
});
}

private void downloadImageNew(String filename, String downloadUrlOfImage){
try{
DownloadManager dm = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
Uri downloadUri = Uri.parse(downloadUrlOfImage);
DownloadManager.Request request = new DownloadManager.Request(downloadUri);
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE)
.setAllowedOverRoaming(false)
.setTitle(filename)
.setDescription("Downloading wallpaper")
.setMimeType("image/jpeg") // Your file type. You can use this code to download other file types also.
.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES,File.separator + "Prism"+ File.separator + filename + ".jpg");
dm.enqueue(request);
Toast.makeText(this, "Image download started.", Toast.LENGTH_SHORT).show();
}catch (Exception e){
Toast.makeText(this, "Image download failed." + e.getMessage().toString(), Toast.LENGTH_SHORT).show();
}
}

private void saveImageToPictures(Bitmap bitmap, @NonNull String name) throws IOException {
OutputStream fos;
try {
Expand All @@ -254,141 +127,4 @@ private void saveImageToPictures(Bitmap bitmap, @NonNull String name) throws IOE
}
res.success(true);
}
}


class SetWallPaperTask extends AsyncTask<Pair<Bitmap, String>, Boolean, Boolean> {

private final Context mContext;

public SetWallPaperTask(final Context context) {
mContext = context;
}

@Override
protected final Boolean doInBackground(Pair<Bitmap, String>... pairs) {
switch (pairs[0].second) {
case "1": {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(mContext);
try {
Uri tempUri = getImageUri(mContext, pairs[0].first);
Log.i("Arguments ", "configureFlutterEngine: " + "Saved image to storage");
File finalFile = new File(getRealPathFromURI(tempUri));
Uri contentURI = getImageContentUri(mContext, finalFile.getAbsolutePath());
Log.i("Arguments ", "configureFlutterEngine: " + "Opening crop intent");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mContext.startActivity(wallpaperManager.getCropAndSetWallpaperIntent(contentURI));
}
// wallpaperManager.setBitmap(pairs[0].first);
} catch (Exception ex) {
ex.printStackTrace();
return false;
}
}
case "2": {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(mContext);
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
wallpaperManager.setBitmap(pairs[0].first, null, true, WallpaperManager.FLAG_LOCK);
}
} catch (IOException ex) {
ex.printStackTrace();
return false;
}
break;
}
case "3": {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(mContext);
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
wallpaperManager.setBitmap(pairs[0].first, null, true, WallpaperManager.FLAG_SYSTEM);
}
} catch (IOException ex) {
ex.printStackTrace();
return false;
}
break;
}
case "4": {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(mContext);
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
wallpaperManager.setBitmap(pairs[0].first, null, true,
WallpaperManager.FLAG_LOCK | WallpaperManager.FLAG_SYSTEM);
}
} catch (IOException ex) {
ex.printStackTrace();
return false;
}
break;
}

}
return true;
}

@Override
protected void onCancelled() {
super.onCancelled();
}

@Override
protected void onPostExecute(Boolean aBoolean) {
myMethod(aBoolean);
}

private void myMethod(Boolean result) {
MainActivity.res.success(result);
}

public static Uri getImageContentUri(Context context, String absPath) {

Cursor cursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[]{MediaStore.Images.Media._ID}, MediaStore.Images.Media.DATA + "=? ",
new String[]{absPath}, null);

if (cursor != null && cursor.moveToFirst()) {
int id = cursor.getInt(cursor.getColumnIndex(MediaStore.MediaColumns._ID));
return Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, Integer.toString(id));

} else if (!absPath.isEmpty()) {
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.DATA, absPath);
return context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
} else {
return null;
}
}

public Uri getImageUri(Context inContext, Bitmap inImage) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
fixMediaDir();
String path = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null);
return Uri.parse(path);
}

public String getRealPathFromURI(Uri uri) {
Cursor cursor = mContext.getContentResolver().query(uri, null, null, null, null);
cursor.moveToFirst();
int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
return cursor.getString(idx);
}

void fixMediaDir() {
File sdcard = Environment.getExternalStorageDirectory();
if (sdcard != null) {
File mediaDir = new File(sdcard, "DCIM/Camera");
if (!mediaDir.exists()) {
mediaDir.mkdirs();
}
}

if (sdcard != null) {
File mediaDir = new File(sdcard, "Pictures");
if (!mediaDir.exists()) {
mediaDir.mkdirs();
}
}
}
}
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.3.4'
classpath 'io.fabric.tools:gradle:1.26.1'
}
Expand Down
3 changes: 2 additions & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

1 change: 1 addition & 0 deletions ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
Loading