Compare commits

..

No commits in common. "master" and "3.1" have entirely different histories.
master ... 3.1

21 changed files with 167 additions and 197 deletions

35
.drone.yml Normal file
View File

@ -0,0 +1,35 @@
kind: pipeline
type: docker
name: default
steps:
- name: build
image: mingc/android-build-box
commands:
- curl -sSL -u "$USERNAME:$PASSWORD" -o app/$STORE_FILE https://cloud.crystalyx.net/remote.php/dav/files/$USERNAME/Bordel/$STORE_FILE
- sh gradlew build bundleRelease assembleRelease
environment:
USERNAME:
from_secret: nextcloud_user
PASSWORD:
from_secret: nextcloud_password
STORE_FILE:
from_secret: android_keyfile
STORE_PASSWORD:
from_secret: android_keypass
KEY_ALIAS:
from_secret: android_keyalias
KEY_PASSWORD:
from_secret: android_keypass
- name: release
image: plugins/gitea-release
settings:
api_key:
from_secret: gitea_token
base_url: https://git.crystalyx.net
files:
- app/build/outputs/apk/debug/app-debug.apk
- app/build/outputs/apk/release/app-release.apk
- app/build/outputs/bundle/release/app-release.aab
when:
event: tag

View File

@ -1,25 +0,0 @@
name: apk
on: [ push ]
jobs:
build:
runs-on: ubuntu-latest
container: mingc/android-build-box
steps:
- uses: actions/checkout@v4
- run: curl -sSL -u "$USERNAME:$PASSWORD" -o app/$STORE_FILE https://cloud.crystalyx.net/remote.php/dav/files/$USERNAME/Bordel/$STORE_FILE
- run: sh gradlew lint build bundleRelease assembleRelease --no-daemon
- uses: akkuman/gitea-release-action@v1
if: gitea.ref_type == 'tag'
with:
files: |
app/build/outputs/apk/debug/app-debug.apk
app/build/outputs/apk/release/app-release.apk
app/build/outputs/bundle/release/app-release.aab
env:
USERNAME: ${{ secrets.USERNAME }}
PASSWORD: ${{ secrets.PASSWORD }}
STORE_FILE: ${{ secrets.STORE_FILE }}
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}

12
.gitignore vendored
View File

@ -1,5 +1,11 @@
.gradle/
*.iml
.gradle
/local.properties
/.idea
.DS_Store
build/
/build
/captures
.externalNativeBuild
.cxx
local.properties
.idea/
*.jks

View File

@ -1,39 +0,0 @@
**Privacy Policy**
I built the Set as wallpaper app as an Open Source app. This is provided by me at no cost and is intended for use as is.
This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my app.
If you choose to use my app, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the app. I will not use or share your information with anyone except as described in this Privacy Policy.
The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which are accessible at Set as wallpaper unless otherwise defined in this Privacy Policy.
**Information Collection and Use**
For a better experience, while using our app, I may require you to provide us with certain personally identifiable information. The information that I request will be retained on your device and is not collected by me in any way.
**Log Data**
I want to inform you that whenever you use my app, in a case of an error in the app I collect data and information (through third-party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing my app, the time and date of your use of the app, and other statistics.
**Security**
I value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and I cannot guarantee its absolute security.
**Links to Other Sites**
This app may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by me. Therefore, I strongly advise you to review the Privacy Policy of these websites. I have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.
**Childrens Privacy**
I do not knowingly collect personally identifiable information from children. I encourage all children to never submit any personally identifiable information through the Application and/or Services. I encourage parents and legal guardians to monitor their children's Internet usage and to help enforce this Policy by instructing their children never to provide personally identifiable information through the Application and/or Services without their permission. If you have reason to believe that a child has provided personally identifiable information to us through the Application and/or Services, please contact us. You must also be at least 16 years of age to consent to the processing of your personally identifiable information in your country (in some countries we may allow your parent or guardian to do so on your behalf).
**Changes to This Privacy Policy**
I may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. I will notify you of any changes by posting the new Privacy Policy on this page.
This policy is effective as of 2024-02-28
**Contact Us**
If you have any questions or suggestions about my Privacy Policy, do not hesitate to contact me at https://blog.crystalyx.net/contact/.

View File

@ -2,8 +2,14 @@
<a href="https://play.google.com/store/apps/details?id=net.crystalyx.setaswallpaper"><img alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png" height="80"/></a>
[![Build Status](https://ci.crystalyx.net/api/badges/Xefir/SetAsWallpaper/status.svg)](https://ci.crystalyx.net/Xefir/SetAsWallpaper)
Provide a useful shortcut to set an image to your Android's wallpaper launcher and lock screen through the "Share" functionality.
## Download
You can find auto generated debug apk on the [Releases](https://git.crystalyx.net/Xefir/SetAsWallpaper/releases) page or on [Google Play](https://play.google.com/store/apps/details?id=net.crystalyx.setaswallpaper).
## Build
`./gradlew zipApksForDebug`

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

View File

@ -1,15 +1,21 @@
apply plugin: 'com.android.application'
plugins {
id 'com.android.application'
}
android {
namespace 'net.crystalyx.setaswallpaper'
compileSdk 34
compileSdkVersion 32
buildToolsVersion "30.0.3"
namespace "net.crystalyx.setaswallpaper"
defaultConfig {
applicationId "net.crystalyx.setaswallpaper"
minSdkVersion 5
targetSdkVersion 34
versionCode 11
versionName "3.4"
//noinspection OldTargetApi
targetSdkVersion 32
versionCode 8
versionName "3.1"
}
signingConfigs {
release {
if (System.env.STORE_FILE) {
@ -20,13 +26,19 @@ android {
}
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
if (System.env.STORE_FILE) {
signingConfig signingConfigs.release
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

View File

@ -1,10 +1,21 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
@ -6,6 +7,7 @@
<application
android:icon="@mipmap/ic_launcher"
android:label="Set as wallpaper"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@android:style/Theme.NoDisplay">
<activity
android:name=".SetWallpaperActivity"

View File

@ -1,39 +0,0 @@
package net.crystalyx.setaswallpaper;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
public class HttpThreadHandler implements Runnable {
private final URL url;
private Bitmap bitmap;
private String errorMessage;
public HttpThreadHandler(URL url) {
this.url = url;
}
@Override
public void run() {
try {
URLConnection connection = url.openConnection();
connection.connect();
InputStream inputStream = connection.getInputStream();
bitmap = BitmapFactory.decodeStream(inputStream);
} catch (IOException e) {
errorMessage = e.getMessage();
}
}
public Bitmap gitBitmap() {
return bitmap;
}
public String getErrorMessage() {
return errorMessage;
}
}

View File

@ -6,13 +6,15 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.widget.Toast;
import java.io.*;
import java.net.URI;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class SetWallpaperActivity extends Activity {
@ -27,61 +29,47 @@ public class SetWallpaperActivity extends Activity {
if ("text/plain".equals(type)) {
handleUrl(intent.getStringExtra(Intent.EXTRA_TEXT));
} else if (type.startsWith("image/")) {
handleStream(getParcelableExtraStream(intent));
handleStream(intent.getParcelableExtra(Intent.EXTRA_STREAM));
}
}
}
@SuppressWarnings("deprecation")
private Uri getParcelableExtraStream(Intent intent) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
return intent.getParcelableExtra(Intent.EXTRA_STREAM, Uri.class);
}
return intent.getParcelableExtra(Intent.EXTRA_STREAM);
}
private void handleUrl(String textUrl) {
URL url;
try {
url = new URI(textUrl).toURL();
} catch (Exception e) {
url = new URL(textUrl);
} catch (MalformedURLException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
return;
}
HttpThreadHandler handler = new HttpThreadHandler(url);
Thread job = new Thread(handler);
ExecutorService executor = Executors.newSingleThreadExecutor();
job.start();
try {
job.join();
} catch (InterruptedException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
Bitmap bitmap = handler.gitBitmap();
String errorMessage = handler.getErrorMessage();
if (bitmap != null) {
launchWallpaperActivity(bitmap);
} else if (errorMessage != null) {
Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT).show();
}
executor.execute(() -> {
try {
URLConnection connection = url.openConnection();
connection.connect();
InputStream inputStream = connection.getInputStream();
launchWallpaperActivity(inputStream);
} catch (IOException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
private void handleStream(Uri uri) {
try {
InputStream inputStream = getContentResolver().openInputStream(uri);
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
launchWallpaperActivity(bitmap);
launchWallpaperActivity(inputStream);
} catch (IOException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
private void launchWallpaperActivity(Bitmap bitmap) {
private void launchWallpaperActivity(InputStream stream) {
WallpaperManager manager = WallpaperManager.getInstance(getApplicationContext());
Bitmap bitmap = BitmapFactory.decodeStream(stream);
try {
manager.setBitmap(bitmap);

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@android:color/transparent"/>
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

View File

@ -1,25 +1,28 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath('com.android.tools.build:gradle:8.4.0')
classpath 'com.android.tools.build:gradle:7.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
mavenCentral()
}
tasks.withType(JavaCompile) {
options.deprecation = true
}
}
tasks.register('clean', Delete) {
task clean(type: Delete) {
delete rootProject.buildDir
}
tasks.withType(JavaCompile).configureEach {
options.deprecation = true
}
}

13
gradle.properties Normal file
View File

@ -0,0 +1,13 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

Binary file not shown.

View File

@ -1,7 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

35
gradlew vendored
View File

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -80,11 +80,13 @@ do
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -131,29 +133,22 @@ location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -198,15 +193,11 @@ if "$cygwin" || "$msys" ; then
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \

21
gradlew.bat vendored
View File

@ -26,7 +26,6 @@ if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@ -43,11 +42,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
@ -57,11 +56,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail

View File

@ -1,3 +1,2 @@
// Boilerplate from https://transang.me/create-a-minimal-android-boilerplate-from-scratch/
rootProject.name = "SetAsWallpaper"
include ':app'