-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f66b41e
Showing
108 changed files
with
2,007 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/* | ||
!.idea/icon.png | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store | ||
|
||
/currentPosition.properties | ||
/captures | ||
/local.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
plugins { | ||
alias(libs.plugins.android.application) | ||
alias(libs.plugins.kotlin.android) | ||
} | ||
|
||
android { | ||
namespace = "website.leifs.delta.breezyweather" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
applicationId = "website.leifs.delta.breezyweather" | ||
minSdk = 11 | ||
targetSdk = 34 | ||
versionCode = 1 | ||
versionName = "1.0" | ||
|
||
} | ||
|
||
buildTypes { | ||
named("release") { | ||
isShrinkResources = false | ||
isMinifyEnabled = false | ||
isDebuggable = false | ||
isCrunchPngs = false // No need to do that, we already optimized them | ||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") | ||
} | ||
} | ||
buildFeatures { | ||
compose = false | ||
buildConfig = false | ||
|
||
// Disable some unused things | ||
aidl = false | ||
renderScript = false | ||
shaders = false | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = JavaVersion.VERSION_1_8.toString() | ||
} | ||
} | ||
|
||
dependencies {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# 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 | ||
|
||
# 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 |
24 changes: 24 additions & 0 deletions
24
app/src/androidTest/java/website/leifs/delta/breezyweather/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package website.leifs.delta.breezyweather | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("website.leifs.delta.breezyweather", appContext.packageName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<application | ||
android:icon="@drawable/weather_partly_cloudy_day_delta" | ||
android:label="@string/app_name" | ||
tools:ignore="AllowBackup,GoogleAppIndexingWarning"> | ||
|
||
<meta-data | ||
android:name="org.breezyweather.PROVIDER_CONFIG" | ||
android:resource="@xml/icon_provider_config" /> | ||
<meta-data | ||
android:name="org.breezyweather.DRAWABLE_FILTER" | ||
android:resource="@xml/icon_provider_drawable_filter" /> | ||
<meta-data | ||
android:name="org.breezyweather.ANIMATOR_FILTER" | ||
android:resource="@xml/icon_provider_animator_filter" /> | ||
<meta-data | ||
android:name="org.breezyweather.SHORTCUT_FILTER" | ||
android:resource="@xml/icon_provider_shortcut_filter" /> | ||
<meta-data | ||
android:name="org.breezyweather.SUN_MOON_FILTER" | ||
android:resource="@xml/icon_provider_sun_moon_filter" /> | ||
|
||
<activity android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<action android:name="org.breezyweather.ICON_PROVIDER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
</application> | ||
|
||
</manifest> |
128 changes: 128 additions & 0 deletions
128
app/src/main/java/website/leifs/delta/breezyweather/DeltaMoonDrawable.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
/** | ||
* This file is part of Breezy Weather Pixel Icon Provider. | ||
* | ||
* Breezy Weather Pixel Icon Provider is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as published by the | ||
* Free Software Foundation, version 3 of the License. | ||
* | ||
* Breezy Weather Pixel Icon Provider is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | ||
* License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Breezy Weather Pixel Icon Provider. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package website.leifs.delta.breezyweather | ||
|
||
import android.graphics.Canvas | ||
import android.graphics.Color | ||
import android.graphics.ColorFilter | ||
import android.graphics.LinearGradient | ||
import android.graphics.Paint | ||
import android.graphics.PixelFormat | ||
import android.graphics.PorterDuff | ||
import android.graphics.PorterDuffXfermode | ||
import android.graphics.Rect | ||
import android.graphics.Shader | ||
import android.graphics.Xfermode | ||
import android.graphics.drawable.Drawable | ||
import kotlin.math.min | ||
|
||
class DeltaMoonDrawable : Drawable() { | ||
private val mPaint = Paint().apply { | ||
isAntiAlias = true | ||
} | ||
private val mClearXfermode: Xfermode | ||
|
||
private val mColors = intArrayOf( | ||
Color.rgb(189, 154, 255), | ||
Color.rgb(140, 114, 189) | ||
) | ||
private var mAlpha: Float = 1f | ||
private var mBounds: Rect | ||
private var mCoreRadius = 0f | ||
private var mCoreCenterX = 0f | ||
private var mCoreCenterY = 0f | ||
private var mShader: Shader? = null | ||
private var mShaderRadius = 0f | ||
private var mShaderCenterX = 0f | ||
private var mShaderCenterY = 0f | ||
|
||
init { | ||
mClearXfermode = PorterDuffXfermode(PorterDuff.Mode.CLEAR) | ||
mBounds = bounds | ||
ensurePosition(mBounds) | ||
} | ||
|
||
private fun ensurePosition(bounds: Rect) { | ||
val boundSize = min(bounds.width(), bounds.height()) | ||
val rect2 = Rect( | ||
bounds.left + (bounds.width() - boundSize) / 2, | ||
bounds.top + (bounds.height() - boundSize) / 2, | ||
bounds.right - (bounds.width() - boundSize) / 2, | ||
bounds.bottom - (bounds.height() - boundSize) / 2 | ||
) | ||
mCoreRadius = 0.4062f * boundSize | ||
mCoreCenterX = (rect2.width() / 2.0f) + rect2.left | ||
mCoreCenterY = (rect2.height() / 2.0f) + rect2.top | ||
mShaderRadius = 0.332f * boundSize | ||
mShaderCenterX = (0.7656f * boundSize) + rect2.left | ||
mShaderCenterY = (boundSize * 0.25f) + rect2.top | ||
mShader = LinearGradient( | ||
mCoreCenterX, | ||
mCoreCenterY - mCoreRadius, | ||
mCoreCenterX, | ||
mCoreCenterY + mCoreRadius, | ||
mColors[0], | ||
mColors[1], | ||
Shader.TileMode.CLAMP | ||
) | ||
} | ||
|
||
override fun onBoundsChange(bounds: Rect) { | ||
mBounds = bounds | ||
ensurePosition(bounds) | ||
} | ||
|
||
override fun draw(canvas: Canvas) { | ||
mPaint.alpha = (mAlpha * 255).toInt() | ||
val layerId = canvas.saveLayer( | ||
mBounds.left.toFloat(), | ||
mBounds.top.toFloat(), | ||
mBounds.right.toFloat(), | ||
mBounds.bottom.toFloat(), | ||
null, | ||
Canvas.ALL_SAVE_FLAG | ||
) | ||
mPaint.setShader(mShader) | ||
canvas.drawCircle(mCoreCenterX, mCoreCenterY, mCoreRadius, mPaint) | ||
mPaint.setShader(null) | ||
mPaint.setXfermode(mClearXfermode) | ||
canvas.drawCircle(mShaderCenterX, mShaderCenterY, mShaderRadius, mPaint) | ||
mPaint.setXfermode(null) | ||
canvas.restoreToCount(layerId) | ||
} | ||
|
||
override fun setAlpha(alpha: Int) { | ||
mAlpha = alpha.toFloat() | ||
} | ||
|
||
override fun setColorFilter(colorFilter: ColorFilter?) { | ||
mPaint.setColorFilter(colorFilter) | ||
} | ||
|
||
@Deprecated("Deprecated in Java") | ||
override fun getOpacity(): Int { | ||
return PixelFormat.OPAQUE | ||
} | ||
|
||
override fun getIntrinsicWidth(): Int { | ||
return mBounds.width() | ||
} | ||
|
||
override fun getIntrinsicHeight(): Int { | ||
return mBounds.height() | ||
} | ||
} |
Oops, something went wrong.