Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
GitGitro committed Jul 6, 2024
0 parents commit f66b41e
Show file tree
Hide file tree
Showing 108 changed files with 2,007 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .gitignore
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
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
48 changes: 48 additions & 0 deletions app/build.gradle.kts
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 {}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
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
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)
}
}
36 changes: 36 additions & 0 deletions app/src/main/AndroidManifest.xml
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>
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()
}
}
Loading

0 comments on commit f66b41e

Please sign in to comment.