Compare commits
140 Commits
Author | SHA1 | Date |
---|---|---|
Michel Roux | 5f5295ca29 | |
Renovate Bot | 86bfa491f6 | |
Michel Roux | e61970d590 | |
Renovate Bot | 508511ea5e | |
Michel Roux | c23078c3fe | |
Renovate Bot | 0343759b00 | |
Michel Roux | a6f0135608 | |
Renovate Bot | dc43efd7d4 | |
Michel Roux | 6fe19aea3d | |
Michel Roux | 70454c7dd8 | |
Michel Roux | 7a064c9759 | |
Michel Roux | a81053de21 | |
Renovate Bot | ea932b2380 | |
Michel Roux | d810e9ec84 | |
Renovate Bot | 028032dc25 | |
Michel Roux | c74e1b3bc0 | |
Renovate Bot | 9f8c706210 | |
Michel Roux | 34331f0cbb | |
Renovate Bot | 6f6ff0d362 | |
Michel Roux | 3ac8107aa0 | |
Renovate Bot | 6b408f4e22 | |
Michel Roux | eb13df8989 | |
Michel Roux | 1596b21435 | |
Renovate Bot | 6c690bfb5c | |
Renovate Bot | 2db66942e6 | |
Michel Roux | b258c3b6d9 | |
Renovate Bot | 2ea9018685 | |
Michel Roux | 288d3dfcd0 | |
Renovate Bot | 76251ae2e1 | |
Michel Roux | bd7f81d445 | |
Renovate Bot | de9918f36f | |
Michel Roux | 5a38aed3db | |
Renovate Bot | d468fa62d5 | |
Michel Roux | b5ec2fb38a | |
Michel Roux | a39cbf0710 | |
Michel Roux | 6d3870ed47 | |
Renovate Bot | 5fc47c6e1e | |
Michel Roux | 150ba5ae6d | |
Renovate Bot | 5d734648ab | |
Michel Roux | 7d2d0d56bf | |
Renovate Bot | 81f11e49d0 | |
Michel Roux | 3431519c1a | |
Michel Roux | 4def790dbb | |
Renovate Bot | d553f63183 | |
Michel Roux | 8879e5095e | |
Michel Roux | 894449650b | |
Renovate Bot | c31ebe3efd | |
Michel Roux | 2b5cbb4aaa | |
Renovate Bot | 465256f9fc | |
Michel Roux | 09eda47d80 | |
Michel Roux | 54bd7058f7 | |
Michel Roux | a1c54a9735 | |
Michel Roux | 4e8dc03312 | |
Michel Roux | 436a35998c | |
Michel Roux | 60d4de410a | |
Michel Roux | 4b6c6b87a0 | |
Michel Roux | 79902971a2 | |
Michel Roux | 4e9f56c151 | |
Michel Roux | e8494ecec8 | |
Michel Roux | e3e01a4e4b | |
Michel Roux | 991943c93d | |
Michel Roux | 07253daeaa | |
Michel Roux | 4050c684d8 | |
Michel Roux | 7c88cba0a8 | |
Michel Roux | eb4b25c46f | |
Michel Roux | 6cf1267797 | |
Michel Roux | 3fff390a54 | |
Michel Roux | a002532036 | |
Michel Roux | 6bd04af856 | |
Michel Roux | 4ad151ebea | |
Michel Roux | 00d5543f12 | |
Michel Roux | a1260ae536 | |
Michel Roux | 0e71b36361 | |
Michel Roux | 43fd5f426f | |
Michel Roux | ff02fa2235 | |
Michel Roux | b725d7880b | |
Michel Roux | 9c9ec48160 | |
Michel Roux | 6756374c5d | |
Michel Roux | 40c19fe9e0 | |
Michel Roux | fe88333f95 | |
Michel Roux | 39d4eedd9c | |
Michel Roux | 9e83fa1793 | |
Michel Roux | 7ca78b6843 | |
Michel Roux | 1dceed7ea6 | |
Michel Roux | 0a948977be | |
Michel Roux | 3004af9c8b | |
Michel Roux | dac8c199f6 | |
Michel Roux | 3f506a78e2 | |
Michel Roux | 811962796b | |
Michel Roux | a064e07345 | |
Michel Roux | ac664c62c2 | |
Michel Roux | 15d9b8dd49 | |
Michel Roux | c6bcace566 | |
Michel Roux | c5d943bfdd | |
Michel Roux | 20d9557ec0 | |
Michel Roux | 0372c20d48 | |
Michel Roux | caf8e90acf | |
Michel Roux | b18ef5d0c0 | |
Michel Roux | 3bdb6a0e8d | |
Michel Roux | 4360660532 | |
Michel Roux | 6fb22f722f | |
Michel Roux | afd1479f84 | |
Michel Roux | 72e4aec44d | |
Michel Roux | 86af39b772 | |
Michel Roux | 2c7417ca28 | |
Michel Roux | 7034d7f611 | |
Michel Roux | ebbb887e07 | |
Michel Roux | 1c331e5b07 | |
Michel Roux | 4b452bc1a0 | |
Michel Roux | bd8266538d | |
Michel Roux | 68ae955953 | |
Michel Roux | 89494777dd | |
Michel Roux | af6f50da30 | |
Michel Roux | 664b357164 | |
Michel Roux | 9f119f969d | |
Michel Roux | 53511e0088 | |
Michel Roux | 94ce37b2b8 | |
Michel Roux | adfbecc852 | |
Michel Roux | 5cd96ad042 | |
Michel Roux | 52146de8fd | |
Michel Roux | e39dd5042b | |
Michel Roux | 37bbbea2e7 | |
Michel Roux | 68e8665903 | |
Michel Roux | f377d28df9 | |
Michel Roux | 4c006ddcd6 | |
Michel Roux | a24d419abd | |
Michel Roux | a76e180081 | |
Michel Roux | beb7185527 | |
Michel Roux | 133f4a13a7 | |
Michel Roux | 4f62ca01f9 | |
Michel Roux | b9093029c2 | |
Michel Roux | 7cca1c112c | |
Michel Roux | e90716a1bd | |
Michel Roux | e30df9f476 | |
Michel Roux | b58effba14 | |
Michel Roux | dfc026b52b | |
Michel Roux | 89d3b19f65 | |
Michel Roux | 9492f2f91c | |
Michel Roux | 69d7f9f741 | |
Michel Roux | e9a61dde36 |
34
.drone.yml
34
.drone.yml
|
@ -1,34 +0,0 @@
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: default
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build
|
|
||||||
image: mingc/android-build-box
|
|
||||||
commands:
|
|
||||||
- curl -sSL -u "$USERNAME:$PASSWORD" -o $KEYFILE https://cloud.crystalyx.net/remote.php/dav/files/$USERNAME/Bordel/$KEYFILE
|
|
||||||
- sh gradlew build bundle
|
|
||||||
- jarsigner -verbose -keystore $KEYFILE -storepass $KEYPASS -keypass $KEYPASS app/build/outputs/bundle/release/app-release.aab $KEYALIAS
|
|
||||||
- /opt/android-sdk/build-tools/30.0.2/apksigner sign -v --ks $KEYFILE --ks-key-alias $KEYALIAS --ks-pass pass:$KEYPASS --key-pass pass:$KEYPASS app/build/outputs/apk/debug/app-debug.apk
|
|
||||||
environment:
|
|
||||||
USERNAME:
|
|
||||||
from_secret: nextcloud_user
|
|
||||||
PASSWORD:
|
|
||||||
from_secret: nextcloud_password
|
|
||||||
KEYFILE:
|
|
||||||
from_secret: android_keyfile
|
|
||||||
KEYALIAS:
|
|
||||||
from_secret: android_keyalias
|
|
||||||
KEYPASS:
|
|
||||||
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/bundle/release/app-release.aab
|
|
||||||
when:
|
|
||||||
event: tag
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
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 }}
|
|
@ -1,10 +1,5 @@
|
||||||
*.iml
|
.gradle/
|
||||||
.gradle
|
|
||||||
/local.properties
|
|
||||||
/.idea
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/build
|
build/
|
||||||
/captures
|
|
||||||
.externalNativeBuild
|
|
||||||
.cxx
|
|
||||||
local.properties
|
local.properties
|
||||||
|
.idea/
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
**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.
|
||||||
|
|
||||||
|
**Children’s 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/.
|
|
@ -2,14 +2,8 @@
|
||||||
|
|
||||||
<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>
|
<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.
|
Provide a useful shortcut to set an image to your Android's wallpaper launcher and lock screen through the "Share" functionality.
|
||||||
|
|
||||||
## Download
|
## 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).
|
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 +0,0 @@
|
||||||
/build
|
|
|
@ -1,32 +1,32 @@
|
||||||
plugins {
|
apply plugin: 'com.android.application'
|
||||||
id 'com.android.application'
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
namespace 'net.crystalyx.setaswallpaper'
|
||||||
buildToolsVersion "30.0.3"
|
compileSdk 34
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "net.crystalyx.setaswallpaper"
|
applicationId "net.crystalyx.setaswallpaper"
|
||||||
minSdkVersion 23
|
minSdkVersion 5
|
||||||
targetSdkVersion 30
|
targetSdkVersion 34
|
||||||
versionCode 5
|
versionCode 11
|
||||||
versionName "2.3"
|
versionName "3.4"
|
||||||
|
}
|
||||||
|
signingConfigs {
|
||||||
|
release {
|
||||||
|
if (System.env.STORE_FILE) {
|
||||||
|
storeFile file(System.env.STORE_FILE)
|
||||||
|
storePassword System.env.STORE_PASSWORD
|
||||||
|
keyAlias System.env.KEY_ALIAS
|
||||||
|
keyPassword System.env.KEY_PASSWORD
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
if (System.env.STORE_FILE) {
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation "androidx.core:core:1.6.0"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,10 @@
|
||||||
# Add project specific ProGuard rules here.
|
# Add project specific ProGuard rules here.
|
||||||
# You can control the set of applied configuration files using the
|
# By default, the flags in this file are appended to flags specified
|
||||||
# proguardFiles setting in build.gradle.
|
# 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.
|
||||||
#
|
#
|
||||||
# For more details, see
|
# For more details, see
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
# Add any project specific keep options here:
|
||||||
# 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
|
|
||||||
|
|
|
@ -1,37 +1,26 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="net.crystalyx.setaswallpaper">
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="false"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:usesCleartextTraffic="true"
|
android:label="Set as wallpaper"
|
||||||
android:label="Set as wallpaper"
|
android:theme="@android:style/Theme.NoDisplay">
|
||||||
android:icon="@mipmap/ic_launcher"
|
<activity
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:name=".SetWallpaperActivity"
|
||||||
android:supportsRtl="true"
|
android:exported="true">
|
||||||
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
|
|
||||||
<activity android:name=".SetWallpaperActivity">
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SEND"/>
|
<action android:name="android.intent.action.SEND" />
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<data android:mimeType="image/*"/>
|
<data android:mimeType="image/*" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SEND"/>
|
<action android:name="android.intent.action.SEND" />
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<data android:mimeType="text/plain"/>
|
<data android:mimeType="text/plain" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<provider android:authorities="net.crystalyx.setaswallpaper.provider"
|
|
||||||
android:name="androidx.core.content.FileProvider"
|
|
||||||
android:grantUriPermissions="true"
|
|
||||||
android:exported="false">
|
|
||||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
|
|
||||||
android:resource="@xml/file_paths"/>
|
|
||||||
</provider>
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,29 +1,25 @@
|
||||||
package net.crystalyx.setaswallpaper;
|
package net.crystalyx.setaswallpaper;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.WallpaperManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.core.content.FileProvider;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.MalformedURLException;
|
import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
public class SetWallpaperActivity extends Activity {
|
public class SetWallpaperActivity extends Activity {
|
||||||
|
|
||||||
private boolean toBeFinished;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
toBeFinished = false;
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
String type = intent.getType();
|
String type = intent.getType();
|
||||||
|
|
||||||
|
@ -31,91 +27,71 @@ public class SetWallpaperActivity extends Activity {
|
||||||
if ("text/plain".equals(type)) {
|
if ("text/plain".equals(type)) {
|
||||||
handleUrl(intent.getStringExtra(Intent.EXTRA_TEXT));
|
handleUrl(intent.getStringExtra(Intent.EXTRA_TEXT));
|
||||||
} else if (type.startsWith("image/")) {
|
} else if (type.startsWith("image/")) {
|
||||||
launchWallpaperActivity(intent.getParcelableExtra(Intent.EXTRA_STREAM), type);
|
handleStream(getParcelableExtraStream(intent));
|
||||||
} else {
|
|
||||||
toBeFinished = true;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
toBeFinished = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings("deprecation")
|
||||||
protected void onPause() {
|
private Uri getParcelableExtraStream(Intent intent) {
|
||||||
super.onPause();
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
toBeFinished = true;
|
return intent.getParcelableExtra(Intent.EXTRA_STREAM, Uri.class);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
|
|
||||||
if (!toBeFinished) {
|
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private String generateRandomString() {
|
return intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||||
int leftLimit = 97; // letter 'a'
|
|
||||||
int rightLimit = 122; // letter 'z'
|
|
||||||
int targetStringLength = 3;
|
|
||||||
Random random = new Random();
|
|
||||||
StringBuilder buffer = new StringBuilder(targetStringLength);
|
|
||||||
for (int i = 0; i < targetStringLength; i++) {
|
|
||||||
int randomLimitedInt = leftLimit + (int)
|
|
||||||
(random.nextFloat() * (rightLimit - leftLimit + 1));
|
|
||||||
buffer.append((char) randomLimitedInt);
|
|
||||||
}
|
|
||||||
return buffer.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleUrl(String textUrl) {
|
private void handleUrl(String textUrl) {
|
||||||
URL url;
|
URL url;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
url = new URL(textUrl);
|
url = new URI(textUrl).toURL();
|
||||||
} catch (MalformedURLException e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
HttpThreadHandler handler = new HttpThreadHandler(url);
|
||||||
|
Thread job = new Thread(handler);
|
||||||
|
|
||||||
executor.execute(() -> {
|
job.start();
|
||||||
try {
|
try {
|
||||||
File outputFile = File.createTempFile(generateRandomString(), generateRandomString(), getCacheDir());
|
job.join();
|
||||||
URLConnection connection = url.openConnection();
|
} catch (InterruptedException e) {
|
||||||
connection.connect();
|
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
InputStream inputStream = connection.getInputStream();
|
Bitmap bitmap = handler.gitBitmap();
|
||||||
OutputStream outputStream = new FileOutputStream(outputFile);
|
String errorMessage = handler.getErrorMessage();
|
||||||
|
if (bitmap != null) {
|
||||||
byte[] data = new byte[1024];
|
launchWallpaperActivity(bitmap);
|
||||||
int count;
|
} else if (errorMessage != null) {
|
||||||
|
Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT).show();
|
||||||
while ((count = inputStream.read(data)) != -1) {
|
}
|
||||||
outputStream.write(data, 0, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
outputStream.flush();
|
|
||||||
outputStream.close();
|
|
||||||
inputStream.close();
|
|
||||||
|
|
||||||
Uri uri = FileProvider.getUriForFile(getApplicationContext(), getPackageName() + ".provider", outputFile);
|
|
||||||
launchWallpaperActivity(uri, connection.getContentType());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchWallpaperActivity(Uri uri, String mimeType) {
|
private void handleStream(Uri uri) {
|
||||||
Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
|
try {
|
||||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
InputStream inputStream = getContentResolver().openInputStream(uri);
|
||||||
intent.setDataAndType(uri, mimeType);
|
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
|
||||||
intent.putExtra("mimeType", mimeType);
|
launchWallpaperActivity(bitmap);
|
||||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
} catch (IOException e) {
|
||||||
startActivity(Intent.createChooser(intent, "Set as:"));
|
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void launchWallpaperActivity(Bitmap bitmap) {
|
||||||
|
WallpaperManager manager = WallpaperManager.getInstance(getApplicationContext());
|
||||||
|
|
||||||
|
try {
|
||||||
|
manager.setBitmap(bitmap);
|
||||||
|
} catch (IOException e) {
|
||||||
|
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.makeText(this, "Wallpaper set!", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@color/ic_launcher_background"/>
|
<background android:drawable="@android:color/transparent"/>
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
|
@ -1,5 +0,0 @@
|
||||||
<?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>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="ic_launcher_background">#FFFFFF</color>
|
|
||||||
</resources>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<paths>
|
|
||||||
<cache-path name="cache" path="." />
|
|
||||||
</paths>
|
|
15
build.gradle
15
build.gradle
|
@ -1,24 +1,25 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "com.android.tools.build:gradle:4.2.2"
|
classpath('com.android.tools.build:gradle:8.4.0')
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
|
||||||
// in the individual module build.gradle files
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
tasks.register('clean', Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
options.deprecation = true
|
||||||
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
# 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
|
|
||||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
|
||||||
# Android operating system, and which are packaged with your app"s APK
|
|
||||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
|
||||||
android.useAndroidX=true
|
|
Binary file not shown.
|
@ -1,5 +1,7 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright 2015 the original author or authors.
|
# Copyright © 2015-2021 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -17,67 +17,99 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# 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
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD=maximum
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MSYS* | MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
@ -87,9 +119,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
@ -98,88 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
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.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
0) set -- ;;
|
|
||||||
1) set -- "$args0" ;;
|
|
||||||
2) set -- "$args0" "$args1" ;;
|
|
||||||
3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=`save "$@"`
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
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.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
|
@ -25,7 +25,8 @@
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@ -40,13 +41,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
|
// Boilerplate from https://transang.me/create-a-minimal-android-boilerplate-from-scratch/
|
||||||
rootProject.name = "SetAsWallpaper"
|
rootProject.name = "SetAsWallpaper"
|
||||||
include ':app'
|
include ':app'
|
||||||
|
|
Loading…
Reference in New Issue