Skip to content

Commit

Permalink
code cleanup for 0.1.0-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
berkaytumal committed Aug 17, 2024
1 parent c972d7c commit 4624891
Show file tree
Hide file tree
Showing 21 changed files with 361 additions and 115 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
minSdk = 26
targetSdk = 34
versionCode = 1
versionName = "1.0"
versionName = "0.1.0-beta.1"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@

<body style="perspective: var(--flow-perspective)">
<div class="innerApp">
<img src="/temp_test/4.png" style="
z-index: 20;
position: fixed;
left: 0px;
top: -32px;
opacity: 0.25;
pointer-events: none;
" />

<h1 class="app-title">Settings</h1>
<div class="app-tabs">
<p class="active-tab">Theme</p>
Expand Down Expand Up @@ -90,13 +81,59 @@ <h1 class="app-title">Accent Color</h1>
<div class="picker-option">color</div>
</div>
</div>
<p class="text" style="margin-top: 40px;">
You can change the size and number of tiles available on your home screen.
</p>
<div class="group">
<p class="group-title">Show more Tiles</p>
<div class="tile-selector">
<p>Off</p>
<div>
<div id="tile-toggle-switch" class="metro-toggle-switch"></div>
</div>
</div>
</div>

<div id="device-placeholder">
<svg viewBox="1 0 428 264" width="428" height="264">
<path
d="M 1 264 L 1 65 C 1.065 47.159 8.358 30.718 20.038 19.038 C 31.718 7.358 48.159 0.065 66 0 L 364 0 C 381.841 0.065 398.282 7.358 409.962 19.038 C 421.642 30.718 428.935 47.159 429 65 L 429 264 L 426 264 L 426 65 C 426.065 47.771 419.143 32.462 407.841 21.159 C 396.538 9.857 381.229 2.935 364 3 L 66 3 C 48.771 2.935 33.462 9.857 22.159 21.159 C 10.857 32.462 3.935 47.771 4 65 L 4 264 Z"
style="fill: rgb(255, 255, 255);"></path>
<path
d="M 11 264 L 11 65 C 11.044 49.608 17.323 35.481 27.402 25.402 C 37.481 15.323 51.608 9.044 67 9 L 363 9 C 378.392 9.044 392.519 15.323 402.598 25.402 C 412.677 35.481 418.956 49.608 419 65 L 419 264 L 417 264 L 417 65 C 417.044 50.016 411.011 36.643 401.184 26.816 C 391.357 16.989 377.984 10.956 363 11 L 67 11 C 52.016 10.956 38.643 16.989 28.816 26.816 C 18.989 36.643 12.956 50.016 13 65 L 13 264 Z"
style="fill: rgb(255, 255, 255);"></path>
<path
d="M 25.5 264 L 25.5 65 C 25.565 53.648 30.228 43.083 37.655 35.655 C 45.083 28.228 55.648 23.565 67 23.5 L 363 23.5 C 374.352 23.565 384.917 28.228 392.345 35.655 C 399.772 43.083 404.435 53.648 404.5 65 L 404.5 264 L 401.5 264 L 401.5 65 C 401.565 54.261 397.273 44.826 390.223 37.777 C 383.174 30.727 373.739 26.435 363 26.5 L 67 26.5 C 56.261 26.435 46.826 30.727 39.777 37.777 C 32.727 44.826 28.435 54.261 28.5 65 L 28.5 264 Z"
style="fill: rgb(255, 255, 255);"></path>
<path
d="M 226.277 49.277 C 226.277 52.319 224.96 55.265 222.974 57.251 C 220.988 59.237 218.042 60.554 215 60.554 C 211.958 60.554 209.012 59.237 207.026 57.251 C 205.04 55.265 203.723 52.319 203.723 49.277 C 203.723 46.235 205.04 43.289 207.026 41.303 C 209.012 39.317 211.958 38 215 38 C 218.042 38 220.988 39.317 222.974 41.303 C 224.96 43.289 226.277 46.235 226.277 49.277 Z M 221.56 42.717 C 219.826 40.983 217.634 40 215 40 C 212.366 40 210.174 40.983 208.44 42.717 C 206.706 44.451 205.723 46.643 205.723 49.277 C 205.723 51.911 206.706 54.103 208.44 55.837 C 210.174 57.571 212.366 58.554 215 58.554 C 217.634 58.554 219.826 57.571 221.56 55.837 C 223.294 54.103 224.277 51.911 224.277 49.277 C 224.277 46.643 223.294 44.451 221.56 42.717 Z"
style="fill: rgb(255, 255, 255);"></path>
<path
d="M 174.646 10.354 L 179.646 15.354 L 179.793 15.5 L 180 15.5 L 250 15.5 L 250.207 15.5 L 250.354 15.354 L 255.354 10.354 L 254.646 9.646 L 249.793 14.5 L 180.207 14.5 L 175.354 9.646 Z"
style="fill: rgb(255, 255, 255);"></path>
</svg>
<svg class="selected" viewBox="40 84.207 350 170" width="350" height="170">
<path
d="M 40 84.207 L 210 84.207 L 210 254.207 L 40 254.207 L 40 84.207 Z M 220 84.207 L 300 84.207 L 300 164.207 L 220 164.207 L 220 84.207 Z M 220 174.207 L 300 174.207 L 300 254.207 L 220 254.207 L 220 174.207 Z M 310 84.207 L 390 84.207 L 390 164.207 L 310 164.207 L 310 84.207 Z M 310 174.207 L 390 174.207 L 390 254.207 L 310 254.207 L 310 174.207 Z"
style="fill: var(--accent-color);"></path>
</svg>
<svg viewBox="40 84.207 350 179.793" width="350" height="179.793">
<path
d="M 280 204.207 L 390 204.207 L 390 264 L 280 264 Z M 160 84.207 L 390 84.207 L 390 194.207 L 160 194.207 Z M 160 204.207 L 270 204.207 L 270 264 L 160 264 Z M 40 204.207 L 150 204.207 L 150 264 L 40 264 Z M 40 84.207 L 150 84.207 L 150 194.207 L 40 194.207 Z"
style="fill: var(--accent-color);"></path>
</svg>
</div>

</div>
</div>
<div class="settings-page">Coming soon!</div>
<div class="settings-page" id="advanced-tab">
<button class="metro-button">Dump Apps JSON</button>
<button class="metro-button">Reset Groove Launcher (No Confirmation!)</button>
</div>
<div class="settings-page">
<div class="scrollable article-f" style="perspective: var(--flow-perspective);">
<h1>Groove Launcher</h1>

<h1 id="about-app-name">Groove Launcher</h1>
<h2 id="about-app-version">Version: Loading...</h2>
<p>
<strong>Groove Launcher</strong> is a metro-styled launcher
designed for a customizable and sleek user experience. Users can
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package web.bmdominatezz.gravy;

import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
Expand Down Expand Up @@ -248,9 +250,20 @@ public void run() {
}

@JavascriptInterface
public void openURL(String url){
public void openURL(String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
mainActivity.startActivity(intent);
}

@JavascriptInterface
public String getAppVersion() {
try {
PackageInfo packageInfo = mainActivity.packageManager.getPackageInfo(mainActivity.getPackageName(), 0);
return packageInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return "unknown";
}
}

}
56 changes: 41 additions & 15 deletions src/apps/groove.internal.settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@

<body style="perspective: var(--flow-perspective)">
<div class="innerApp">
<img src="/temp_test/4.png" style="
z-index: 20;
position: fixed;
left: 0px;
top: -32px;
opacity: 0.25;
pointer-events: none;
" />

<h1 class="app-title">Settings</h1>
<div class="app-tabs">
<p class="active-tab">Theme</p>
Expand Down Expand Up @@ -90,24 +81,59 @@ <h1 class="app-title">Accent Color</h1>
<div class="picker-option">color</div>
</div>
</div>
<p class="text" style="margin-top: 60px;">
<p class="text" style="margin-top: 40px;">
You can change the size and number of tiles available on your home screen.
</p>
<div class="group">
<p class="group-title">Accent color</p>
<p class="group-title">Show more Tiles</p>
<div class="tile-selector">
<p>Off</p>
<div></div>
<div>
<div id="tile-toggle-switch" class="metro-toggle-switch"></div>
</div>
</div>
</div>

<div id="device-placeholder">
<svg viewBox="1 0 428 264" width="428" height="264">
<path
d="M 1 264 L 1 65 C 1.065 47.159 8.358 30.718 20.038 19.038 C 31.718 7.358 48.159 0.065 66 0 L 364 0 C 381.841 0.065 398.282 7.358 409.962 19.038 C 421.642 30.718 428.935 47.159 429 65 L 429 264 L 426 264 L 426 65 C 426.065 47.771 419.143 32.462 407.841 21.159 C 396.538 9.857 381.229 2.935 364 3 L 66 3 C 48.771 2.935 33.462 9.857 22.159 21.159 C 10.857 32.462 3.935 47.771 4 65 L 4 264 Z"
style="fill: rgb(255, 255, 255);"></path>
<path
d="M 11 264 L 11 65 C 11.044 49.608 17.323 35.481 27.402 25.402 C 37.481 15.323 51.608 9.044 67 9 L 363 9 C 378.392 9.044 392.519 15.323 402.598 25.402 C 412.677 35.481 418.956 49.608 419 65 L 419 264 L 417 264 L 417 65 C 417.044 50.016 411.011 36.643 401.184 26.816 C 391.357 16.989 377.984 10.956 363 11 L 67 11 C 52.016 10.956 38.643 16.989 28.816 26.816 C 18.989 36.643 12.956 50.016 13 65 L 13 264 Z"
style="fill: rgb(255, 255, 255);"></path>
<path
d="M 25.5 264 L 25.5 65 C 25.565 53.648 30.228 43.083 37.655 35.655 C 45.083 28.228 55.648 23.565 67 23.5 L 363 23.5 C 374.352 23.565 384.917 28.228 392.345 35.655 C 399.772 43.083 404.435 53.648 404.5 65 L 404.5 264 L 401.5 264 L 401.5 65 C 401.565 54.261 397.273 44.826 390.223 37.777 C 383.174 30.727 373.739 26.435 363 26.5 L 67 26.5 C 56.261 26.435 46.826 30.727 39.777 37.777 C 32.727 44.826 28.435 54.261 28.5 65 L 28.5 264 Z"
style="fill: rgb(255, 255, 255);"></path>
<path
d="M 226.277 49.277 C 226.277 52.319 224.96 55.265 222.974 57.251 C 220.988 59.237 218.042 60.554 215 60.554 C 211.958 60.554 209.012 59.237 207.026 57.251 C 205.04 55.265 203.723 52.319 203.723 49.277 C 203.723 46.235 205.04 43.289 207.026 41.303 C 209.012 39.317 211.958 38 215 38 C 218.042 38 220.988 39.317 222.974 41.303 C 224.96 43.289 226.277 46.235 226.277 49.277 Z M 221.56 42.717 C 219.826 40.983 217.634 40 215 40 C 212.366 40 210.174 40.983 208.44 42.717 C 206.706 44.451 205.723 46.643 205.723 49.277 C 205.723 51.911 206.706 54.103 208.44 55.837 C 210.174 57.571 212.366 58.554 215 58.554 C 217.634 58.554 219.826 57.571 221.56 55.837 C 223.294 54.103 224.277 51.911 224.277 49.277 C 224.277 46.643 223.294 44.451 221.56 42.717 Z"
style="fill: rgb(255, 255, 255);"></path>
<path
d="M 174.646 10.354 L 179.646 15.354 L 179.793 15.5 L 180 15.5 L 250 15.5 L 250.207 15.5 L 250.354 15.354 L 255.354 10.354 L 254.646 9.646 L 249.793 14.5 L 180.207 14.5 L 175.354 9.646 Z"
style="fill: rgb(255, 255, 255);"></path>
</svg>
<svg class="selected" viewBox="40 84.207 350 170" width="350" height="170">
<path
d="M 40 84.207 L 210 84.207 L 210 254.207 L 40 254.207 L 40 84.207 Z M 220 84.207 L 300 84.207 L 300 164.207 L 220 164.207 L 220 84.207 Z M 220 174.207 L 300 174.207 L 300 254.207 L 220 254.207 L 220 174.207 Z M 310 84.207 L 390 84.207 L 390 164.207 L 310 164.207 L 310 84.207 Z M 310 174.207 L 390 174.207 L 390 254.207 L 310 254.207 L 310 174.207 Z"
style="fill: var(--accent-color);"></path>
</svg>
<svg viewBox="40 84.207 350 179.793" width="350" height="179.793">
<path
d="M 280 204.207 L 390 204.207 L 390 264 L 280 264 Z M 160 84.207 L 390 84.207 L 390 194.207 L 160 194.207 Z M 160 204.207 L 270 204.207 L 270 264 L 160 264 Z M 40 204.207 L 150 204.207 L 150 264 L 40 264 Z M 40 84.207 L 150 84.207 L 150 194.207 L 40 194.207 Z"
style="fill: var(--accent-color);"></path>
</svg>
</div>

</div>
</div>
<div class="settings-page">Coming soon!</div>
<div class="settings-page" id="advanced-tab">
<button class="metro-button">Dump Apps JSON</button>
<button class="metro-button">Reset Groove Launcher (No Confirmation!)</button>
</div>
<div class="settings-page">
<div class="scrollable article-f" style="perspective: var(--flow-perspective);">
<h1>Groove Launcher</h1>

<h1 id="about-app-name">Groove Launcher</h1>
<h2 id="about-app-version">Version: Loading...</h2>
<p>
<strong>Groove Launcher</strong> is a metro-styled launcher
designed for a customizable and sleek user experience. Users can
Expand Down
74 changes: 35 additions & 39 deletions src/apps/groove.internal.settings/script.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { applyOverscroll, appViewEvents, grooveColors, grooveThemes, setAccentColor } from "../../scripts/shared/internal-app";
import BScroll from "better-scroll";

window.grooveColors = grooveColors
console.log("hey")
const settingsPages = document.getElementById("settings-pages")
const appTabs = document.querySelector("div.app-tabs")
const bs = new BScroll("#settings-pages", {
Expand Down Expand Up @@ -33,13 +30,10 @@ const allPages = [
]
window.allPages = allPages
allPages.forEach(e => e.classList.add("original"))
console.log(allPages)
function activeTabScroll() {
var x = Math.round(bs.content.getBoundingClientRect().left - 22 + bs.wrapper.offsetWidth)
x -= document.querySelector("div.innerApp").offsetLeft - 22
if (x != lastX) {
//console.log(bs.getCurrentPage().pageX)
//x += settingsPages.offsetWidth
var maxscroll = 0
var scrollEl = []
allTabs.forEach(e => { maxscroll += e.offsetWidth + 25; scrollEl.push(e.offsetWidth + 25) })
Expand All @@ -58,7 +52,6 @@ function activeTabScroll() {
allTabs[Math.floor(scroll + .5 - allTabs.length)].classList.add("active-tab")
//allPages[Math.floor(scroll + .5 - allTabs.length)].classList.add("active-page")
} catch (error) {
console.log(Math.floor(scroll + .5 - allTabs.length))
}
}

Expand All @@ -67,41 +60,13 @@ function activeTabScroll() {
if (scroll >= (index + 1)) { extra = maxscroll }
e.style.transform = `translateX(${-transform + extra}px)`
if (x <= 0) allPages[index].style.transform = scroll >= (index + 1) ? `translateX(${bs.content.offsetWidth - bs.wrapper.offsetWidth * 2}px)` : ""
// if (x >= 0) allPages[index].style.transform = scroll >= (index + 1) ? `translateX(${bs.content.offsetWidth - bs.wrapper.offsetWidth * 2 + (s.maxScrollX + bs.wrapper.offsetWidth)}px)` : ""

//console.log(scroll)
})
if (x > 0) { allPages.slice(-1)[0].style.transform = `translateX(${-100 * allPages.length}%)` }
console.log(x, scroll)
lastX = x
}
requestAnimationFrame(activeTabScroll)
}
activeTabScroll()
bs.on('slideWillChange', (page) => {
// Page about to switch
//console.log(page.pageX, page.pageY)
})

bs.scroller.animater.hooks.on('time', (duration) => {
//console.log("time", duration) // 800
// appTabs.style.setProperty("--duration", duration + "ms")
})
bs.scroller.translater.hooks.on('translate', (point) => {
//console.log(point) // { x: 0, y: 0 }
// activeTabScroll(point.x)
})

appTabs.addEventListener("pointerdown", (e) => {
bs.wrapper.dispatchEvent(new PointerEvent("pointerdown", e))
})
appTabs.addEventListener("pointermove", (e) => {
bs.wrapper.dispatchEvent(new PointerEvent("pointermove", e))
})
appTabs.addEventListener("pointerup", (e) => {
bs.wrapper.dispatchEvent(new PointerEvent("pointerup", e))
})

const scrollers = {
theme: new BScroll("#settings-pages > div > div.settings-page:nth-child(2)", {
bounceTime: 300,
Expand All @@ -124,7 +89,6 @@ setTimeout(() => {
Object.values(scrollers).forEach(e => e.refresh())
}, 600);
document.querySelector("div.first-page > div > div.group > div.picker").addEventListener("flowClick", (e) => {
console.log("hey")
if (e.target.classList.contains("clicked")) {
e.target.classList.remove("clicked")
} else {
Expand All @@ -139,7 +103,6 @@ window.addEventListener('click', function (event) {
});
document.querySelectorAll("div.first-page > div > div.group > div.picker div.picker-option").forEach(e => e.addEventListener("flowClick", (e) => {
const index = Array.from(e.target.parentNode.children).indexOf(e.target)
console.log(index)
setTimeout(() => {
appViewEvents.setTheme(1 - index)
}, 200);
Expand All @@ -148,7 +111,6 @@ document.querySelectorAll("div.first-page > div > div.group > div.picker div.pic
}))
const accentColorPicker = document.getElementById("accent-color-picker")
document.querySelector("div.color-picker").addEventListener("flowClick", (e) => {
console.log("hey")
clearTimeout(window.accentColorPickerTimeout)
accentColorPicker.classList.add("shown-animation", "shown")
})
Expand All @@ -173,7 +135,41 @@ if (!urlParams.has("accentColor")) {
if (urlParams.has("theme")) {
document.querySelector("div.first-page > div > div.group > div.picker").setAttribute("selected", urlParams.get("theme") == "light" ? 0 : 1)
}

document.querySelector("#buymeacoffee").addEventListener("flowClick", (e) => {
Groove.openURL('https://www.buymeacoffee.com/berkaytumal')
})
console.log("dedead")


document.querySelector("#device-placeholder > svg:nth-child(2)").classList.remove("selected")
document.querySelector("#device-placeholder > svg:nth-child(3)").classList.remove("selected")
if (urlParams.has("tileColumns")) {
document.querySelector("div.tile-selector > p").innerText = urlParams.get("tileColumns") == "4" ? "Off" : "On"
if (urlParams.get("tileColumns") != "4") {
document.querySelector("#tile-toggle-switch").setAttribute("checked", "")
document.querySelector("#device-placeholder > svg:nth-child(3)").classList.add("selected")
} else {
document.querySelector("#device-placeholder > svg:nth-child(2)").classList.add("selected")
}
}
document.querySelector("#tile-toggle-switch").addEventListener("checked", (e) => {
document.querySelector("#device-placeholder > svg:nth-child(2)").classList.remove("selected")
document.querySelector("#device-placeholder > svg:nth-child(3)").classList.remove("selected")
document.querySelector("div.tile-selector > p").innerText = e.target.hasAttribute("checked") ? "On" : "Off"
appViewEvents.setTileColumns(e.target.hasAttribute("checked") ? 6 : 4)
if (e.target.hasAttribute("checked")) {
document.querySelector("#device-placeholder > svg:nth-child(3)").classList.add("selected")
} else {
document.querySelector("#device-placeholder > svg:nth-child(2)").classList.add("selected")
}
})
document.querySelectorAll("div.settings-page:not(.original)").forEach(e => e.innerHTML = "")
document.querySelector("#about-app-version").innerText = "Version: " + Groove.getAppVersion()

document.querySelector("#advanced-tab > button:nth-child(1)").addEventListener("flowClick", () => {
navigator.clipboard.writeText(JSON.stringify(window.parent.allappsarchive));
})
document.querySelector("#advanced-tab > button:nth-child(2)").addEventListener("flowClick", () => {
window.localStorage.clear()
appViewEvents.reloadApp()
})
Loading

0 comments on commit 4624891

Please sign in to comment.