Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Commit

Permalink
update android metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
waozixyz committed Dec 19, 2024
1 parent bc8b813 commit fe74f08
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 17 deletions.
21 changes: 21 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,24 @@ inherits = "dev"

[profile.android-dev]
inherits = "dev"

[package.metadata.android]
package_name = "xyz.waozi.myquest"

[package.metadata.bundle]
name = "myQuest"
identifier = "xyz.waozi.myquest"
version = "1.0.0"
copyright = "Copyright (c) 2024 waozixyz"
category = "Productivity"
short_description = "Personal life management and habit tracking application"
long_description = """
myQuest is a comprehensive personal life management application focused on visualization and habit tracking. Features include:
- Habit Tracker: Track daily habits with calendar view and visual progress tracking
- Weekly Todo List: Organize tasks by day with week-at-a-glance view
- Life Timeline: Visualize life journey and experiences on an interactive timeline
- Routine Manager (Coming Soon): Plan and optimize daily schedules with detailed time allocation
Built with Rust and Dioxus, myQuest helps you build consistency, manage tasks, and gain perspective on your life journey.
"""
3 changes: 1 addition & 2 deletions metadata/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xyz.waozi.myQuest">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />

Expand Down
8 changes: 8 additions & 0 deletions metadata/android/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package dev.dioxus.main;

// need to re-export buildconfig down from the parent
import xyz.waozi.myQuest.BuildConfig;
typealias BuildConfig = BuildConfig;


class MainActivity : WryActivity()
64 changes: 64 additions & 0 deletions metadata/android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
}

android {
namespace = "xyz.waozi.myQuest"
compileSdk = 34

defaultConfig {
applicationId = "xyz.waozi.myQuest"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
}

buildTypes {
debug {
isDebuggable = true
isJniDebuggable = true
isMinifyEnabled = false
packaging {
jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so")
jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so")
jniLibs.keepDebugSymbols.add("*/x86/*.so")
jniLibs.keepDebugSymbols.add("*/x86_64/*.so")
}
}
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = "1.8"
}

buildFeatures {
buildConfig = true
}

sourceSets {
getByName("main") {
java.srcDirs("src/main/kotlin")
}
}
}

dependencies {
implementation("androidx.webkit:webkit:1.8.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.11.0")
implementation("androidx.core:core-ktx:1.12.0")
}
23 changes: 20 additions & 3 deletions metadata/android/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<!-- Primary colors -->
<color name="colorPrimary">#942f4a</color>
<color name="colorPrimaryDark">#2d1a2c</color>
<color name="colorAccent">#ff6b97</color>

<!-- Additional theme colors -->
<color name="backgroundColor">#1a0f1f</color>
<color name="secondaryColor">#4a2639</color>
<color name="textColor">#e6dde9</color>

<!-- State colors -->
<color name="successColor">#4caf50</color>
<color name="warningColor">#ff9800</color>
<color name="errorColor">#f44336</color>
<color name="infoColor">#2196f3</color>

<!-- UI element colors -->
<color name="cardBackground">#2d1f33</color>
<color name="borderColor">#4a3655</color>
<color name="inputBackgroundColor">#241a28</color>
</resources>
43 changes: 31 additions & 12 deletions update_android_resources.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
#!/bin/bash

# Source directories
METADATA_DIR="metadata/android"
MANIFEST_SOURCE="$METADATA_DIR/AndroidManifest.xml"
RES_SOURCE="$METADATA_DIR/res"
GRADLE_SOURCE="$METADATA_DIR/build.gradle.kts"
ACTIVITY_SOURCE="$METADATA_DIR/MainActivity.kt"

# Target directories
DEBUG_DIR="target/dx/myquest/debug/android/app/app/src/main"
RELEASE_DIR="target/dx/myquest/release/android/app/app/src/main"
RELEASE_GRADLE="target/dx/myquest/release/android/app/app"
KOTLIN_TARGET="$RELEASE_DIR/kotlin/dev/dioxus/main"

# Function to copy files
copy_android_resources() {
local target_dir="$1"

local gradle_dir="$2"
local kotlin_target="$3"

# Create directories if they don't exist
mkdir -p "$target_dir"

mkdir -p "$gradle_dir"
mkdir -p "$kotlin_target"

# Copy AndroidManifest.xml
if [ -f "$MANIFEST_SOURCE" ]; then
cp "$MANIFEST_SOURCE" "$target_dir/AndroidManifest.xml"
Expand All @@ -24,23 +30,36 @@ copy_android_resources() {
echo "Error: Source AndroidManifest.xml not found at $MANIFEST_SOURCE"
exit 1
fi

# Copy res directory
if [ -d "$RES_SOURCE" ]; then
# Remove existing res directory if it exists
rm -rf "$target_dir/res"
cp -r "$RES_SOURCE" "$target_dir/"
echo "Copied res folder to $target_dir"
else
echo "Error: Source res directory not found at $RES_SOURCE"
exit 1
fi
}

# Copy to debug directory
copy_android_resources "$DEBUG_DIR"
# Copy build.gradle.kts
if [ -f "$GRADLE_SOURCE" ]; then
cp "$GRADLE_SOURCE" "$gradle_dir/build.gradle.kts"
echo "Copied build.gradle.kts to $gradle_dir"
else
echo "Error: Source build.gradle.kts not found at $GRADLE_SOURCE"
exit 1
fi

# Copy MainActivity.kt
if [ -f "$ACTIVITY_SOURCE" ]; then
cp "$ACTIVITY_SOURCE" "$kotlin_target/MainActivity.kt"
echo "Copied MainActivity.kt to $kotlin_target"
else
echo "Error: Source MainActivity.kt not found at $ACTIVITY_SOURCE"
exit 1
fi
}

# Copy to release directory
copy_android_resources "$RELEASE_DIR"

echo "Resource copy completed successfully!"
copy_android_resources "$RELEASE_DIR" "$RELEASE_GRADLE" "$KOTLIN_TARGET"
echo "Resource copy completed successfully!"

0 comments on commit fe74f08

Please sign in to comment.