Skip to content

Commit

Permalink
0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
berkaytumal committed Oct 10, 2024
1 parent 4661fa6 commit 44a3379
Show file tree
Hide file tree
Showing 22 changed files with 1,307 additions and 494 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId = "web.bmdominatezz.gravy"
minSdk = 26
targetSdk = 34
versionCode = 26 //011
versionName = "0.2.6-beta.2"
versionCode = 30 //011
versionName = "0.3.0-beta.3"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Binary file modified android/app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions android/app/src/main/java/web/bmdominatezz/gravy/WebInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -430,4 +430,53 @@ public boolean isDeviceRooted() {
return false;
}
}
@JavascriptInterface
public String getDefaultApps() {
JSONObject json = new JSONObject();
String[] actions = {
Intent.ACTION_DIAL,
Intent.ACTION_SENDTO,
Intent.ACTION_VIEW,
Intent.ACTION_SENDTO,
Intent.ACTION_VIEW,
Intent.ACTION_VIEW,
Intent.ACTION_VIEW,
Intent.ACTION_VIEW
};
String[] data = {
null,
"smsto:",
"http://",
"mailto:",
"market:",
"content://contacts/",
"music://",
"content://media/external/images/media"
};
String[] keys = {
"phoneApp",
"messageApp",
"browserApp",
"mailApp",
"storeApp",
"contactsApp",
"musicApp",
"galleryApp"
};

try {
for (int i = 0; i < actions.length; i++) {
Intent intent = new Intent(actions[i]);
if (data[i] != null) {
intent.setData(Uri.parse(data[i]));
}
ResolveInfo resolveInfo = mainActivity.packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
json.put(keys[i], resolveInfo != null ? resolveInfo.activityInfo.packageName : null);
}
} catch (JSONException e) {
e.printStackTrace();
}

return json.toString();
}
}
21 changes: 15 additions & 6 deletions src/apps/groove.internal.settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,14 @@ <h1 class="app-title">Accent Color</h1>
<div id="font-chooser" class="metro-dropdown-menu" selected="0">
<div class="metro-dropdown-option">Open Sans</div>
<div class="metro-dropdown-option">Noto Sans</div>
<div class="metro-dropdown-option">Choose...<input hidden type="file" accept=".ttf" /></div>
<div class="metro-dropdown-option"><span style="pointer-events: none;" class="name">Choose...</span><input hidden type="file" accept=".ttf" /></div>
</div>
<button class="metro-button" id="clearfont">Remove Font</button>
</div>
</div>
<div class="settings-page" id="advanced-tab">
<div class="group">
<p class="group-title">Package manager</p>
<p class="group-title">Package manager (EXPERIMENTAL)</p>
<div class="metro-dropdown-menu" id="pm-chooser" selected="0">
<div class="metro-dropdown-option">System</div>
<div class="metro-dropdown-option">Root</div>
Expand All @@ -169,11 +170,11 @@ <h1 class="app-title">Accent Color</h1>
</div>
</div>
<div class="settings-page" id="about-tab">
<div class="scrollable article-f" style="perspective: var(--flow-perspective);">
<div class="scrollable article-f" style="perspective: var(--flow-perspective); padding-bottom: 50px;">
<h1 id="about-app-name">Groove Launcher</h1>
<h2 id="about-app-version">Version: Loading...</h2>
<h2 id="about-webview-version">WebView Version: Loading...</h2>
<button class="metro-button" id="resetbtn">Reset Groove Launcher</button>
<h2 id="about-webview-version" style="margin-bottom: 20px;">WebView Version: Loading...</h2>
<button class="metro-button" id="resetbtn" style="margin-bottom: 30px;">Reset Groove Launcher</button>
<p>
<strong>Groove Launcher</strong> is a metro-styled launcher
designed for a customizable and sleek user experience. Users can
Expand Down Expand Up @@ -233,7 +234,15 @@ <h2>Contact</h2>
style="display:block; transform-style: preserve-3d;"><img id="buymeacoffee"
src="./../../assets/default-yellow.png" class="flow-touch" alt="Buy Me A Coffee"
style="height: 60px !important; width: 217px !important;" /></a>

<h2>Team Groove</h2>
<div class="credit-item">
<p>Nathan Tool<span>(Logo Design)</span></p>
<p url="https://reddit.com/u/NateTool"> u/NateTool</p>
</div>
<div class="credit-item">
<p>Berkay Tumal<span>(Developer)</span></p>
<p url="https://github.com/berkaytumal"> berkaytumal</p>
</div>
</div>
</div>
</div>
Expand Down
117 changes: 89 additions & 28 deletions src/apps/groove.internal.settings/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { applyOverscroll, appViewEvents, grooveColors, grooveThemes, setAccentColor } from "../../scripts/shared/internal-app";
import { GrooveScroll, GrooveSlide } from "../../scripts/overscrollFramework";
import imageStore from "../../scripts/imageStore";
import fontStore from "../../scripts/fontStore";
window.fontStore = fontStore
const settingsPages = document.getElementById("settings-pages")
const appTabs = document.querySelector("div.app-tabs")

Expand Down Expand Up @@ -148,16 +150,19 @@ function activeTabScroll() {
}
requestAnimationFrame(activeTabScroll)
}
window.activeTabScroll = activeTabScroll
const scrollers = {
theme: new GrooveScroll("#theme-tab", {
bounceTime: 300,
swipeBounceTime: 200,
outOfBoundaryDampingFactor: 1
outOfBoundaryDampingFactor: 1,
scrollbar: true
}),
about: new GrooveScroll("#about-tab", {
bounceTime: 300,
swipeBounceTime: 200,
outOfBoundaryDampingFactor: 1
outOfBoundaryDampingFactor: 1,
scrollbar: true
}),
accentCatalogue: new GrooveScroll("div.accent-color-catalogue", {
bounceTime: 300,
Expand Down Expand Up @@ -189,7 +194,7 @@ window.appViewEvents = appViewEvents
const urlParams = new URLSearchParams(window.location.search);

if (!urlParams.has("accentColor")) {
document.querySelector("div.color-picker > div.picker-option").innerText = "cobalt"
document.querySelector("div.color-picker > div.picker-option").innerText = "violet"
} else {
document.querySelector("div.color-picker > div.picker-option").innerText = Object.keys(grooveColors).find(key => grooveColors[key] === "#" + urlParams.get("accentColor"));
}
Expand Down Expand Up @@ -255,8 +260,8 @@ document.querySelector("#resetbtn").addEventListener("flowClick", () => {
"Reset Groove Launcher?",
"This will reset your launcher to its default settings. All customizations will be lost.",
[{
title: "Yes", style: "default", inline: true, action: () => {
window.localStorage.clear()
title: "Yes", style: "default", inline: true, action: async () => {
await window.parent.GrooveBoard.backendMethods.reset()
appViewEvents.reloadApp()
}
}, { title: "No", style: "default", inline: true, action: () => { } }]
Expand All @@ -266,28 +271,42 @@ document.getElementById("theme-chooser").addEventListener('selected', (e) => {
appViewEvents.setTheme(e.detail.index == 0 ? grooveThemes.light : grooveThemes.dark)
});


function handleFileInput(event) {
const fileInput = event.target;
const files = fileInput.files;
const file = event.target.files[0];
if (file && file.name.endsWith('.ttf')) {
const reader = new FileReader();

if (files.length === 0) {
// User clicked cancel or didn't select a file
alert('File selection was canceled.');
reader.onload = function (e) {
const fontData = new Uint8Array(e.target.result);
fontStore.saveFont(file.name, fontData).then(() => {
//alert('Font saved successfully!');
document.getElementById("font-chooser").selectOption(2)
parent.GrooveBoard.backendMethods.font.set(2)
document.getElementById("clearfont").style.visibility = "visible"
document.querySelector("#font-chooser > div:nth-child(3) > span.name").innerText = localStorage["customFontName"] || "custom font"
lastX = -9999
setTimeout(() => {
lastX = -9999
}, 100);
});
};

reader.onerror = function () {
parent.GrooveBoard.alert(
"Can’t load font",
"We couldn’t read the font file. Only .ttf fonts are supported. Please try a different file.",
[, { title: "Ok", style: "default", inline: true, action: () => { } }]
);
};

reader.readAsArrayBuffer(file);
} else {
const file = files[0]; // Get the selected file

if (file.type === 'font/ttf') {
// Save the font to IndexedDB (using the saveFont function from before)
saveFont('myFont', file)
.then(() => {
alert('Font saved successfully!');
})
.catch((error) => {
alert('Error saving font: ' + error.message);
});
} else {
alert('Please select a valid TTF font file.');
}
parent.GrooveBoard.alert(
"Unsupported file format",
"The font file isn’t valid. Make sure it’s a .ttf file and try uploading again.",
[, { title: "Ok", style: "default", inline: true, action: () => { } }]
);
}
}

Expand All @@ -300,9 +319,21 @@ document.getElementById("font-chooser").addEventListener("selected", (e) => {
const index = e.detail.index
const lastOne = index == document.getElementById("font-chooser").children.length - 1
if (lastOne) {
document.getElementById("font-chooser").selectOption(e.detail.prevIndex)
document.getElementById("font-chooser").querySelector("input").dispatchEvent(new MouseEvent("click"))
fontStore.hasFont().then(value => {
if (value) {
parent.GrooveBoard.backendMethods.font.set(2)
} else {
document.getElementById("font-chooser").selectOption(e.detail.prevIndex)
document.getElementById("font-chooser").querySelector("input").dispatchEvent(new MouseEvent("click"))
}
})
} else {
parent.GrooveBoard.backendMethods.font.set(index)
}
lastX = -9999
setTimeout(() => {
lastX = -9999
}, 100);
})
requestAnimationFrame(() => {
if (!!localStorage.getItem("UIScale")) {
Expand All @@ -313,10 +344,36 @@ requestAnimationFrame(() => {
const theme = Number(localStorage.getItem("theme"))
document.getElementById("theme-chooser").selectOption(1 - theme)
}
if (!!localStorage.getItem("font")) {
const font = Number(localStorage.getItem("font"))
document.getElementById("font-chooser").selectOption(font)
setFont(font)
fontStore.hasFont().then((value) => {
if (value) {
document.getElementById("clearfont").style.visibility = "visible"
document.querySelector("#font-chooser > div:nth-child(3) > span.name").innerText = localStorage["customFontName"] || "custom font"

} else {
document.getElementById("clearfont").style.visibility = "hidden"
}
});
}

document.getElementById("pm-chooser").selectOption(parent.GrooveBoard.backendMethods.packageManagerProvider.get())
})
document.getElementById("font-chooser").querySelector("input").addEventListener('change', handleFileInput);

document.getElementById("clearfont").addEventListener("flowClick", () => {
fontStore.clearFont()
document.querySelector("#font-chooser > div:nth-child(3) > span.name").innerText = "choose..."
document.getElementById("clearfont").style.visibility = "hidden"
setFont(0)
document.getElementById("font-chooser").selectOption(0)
parent.GrooveBoard.backendMethods.font.set(0)
lastX = -9999
setTimeout(() => {
lastX = -9999
}, 100);
})

document.getElementById("choose-wallpaper").querySelector("input").addEventListener('change', (event) => {
window.parent.canPressHomeButton = false
Expand Down Expand Up @@ -419,4 +476,8 @@ document.getElementById("pm-chooser").addEventListener('selected', (e) => {
pmtryagaian.shizuku()
break;
}
});
});

document.querySelectorAll("div.credit-item > p:nth-child(2)").forEach(e => e.addEventListener("flowClick", function (event) {
Groove.openURL(e.getAttribute("url"))
}))
56 changes: 54 additions & 2 deletions src/apps/groove.internal.settings/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ body {
background-color: transparent !important;
display: flex;
flex-direction: column;
align-items: center;
align-items: cente;

@keyframes app-intro-animation {
0% {
Expand Down Expand Up @@ -442,6 +442,58 @@ a {
background-position: center;
background-size: cover;
}
div.group{

div.group {
margin-top: 22px;
}

div.bscroll-vertical-scrollbar {
width: 3px !important;
right: 2px !important;

div.bscroll-indicator {
border: none !important;
background: #666666 !important;

body.light-mode & {
background: #A6A6A6 !important;
}
}
}

div.credit-item {
font-weight: 300;
font-size: 24px;
display: flex;
transform-style: preserve-3d;
margin: 15px 0px;

p {
padding: 0px;
margin: 0px;

span {
margin: 0px 10px;
opacity: .5;
font-size: 15px;
}
}

p:first-child {
flex-grow: 1;
}

p:last-child {
@include flow-touch;
color: var(--accent-color);
}

&:last-of-type {
margin-bottom: 30px;

}

&:first-of-type {
margin-top: 0px;
}
}
Loading

0 comments on commit 44a3379

Please sign in to comment.