Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Settings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ LauncherPage {
pluginSettingsItemColumn.loadAvailablePlugins()
}

// Component.onCompleted: {
// var fonts = Qt.fontFamilies()
// for (var i = 0; i < fonts.length; i++) console.debug("Settings | Font: " + fonts[i])
// }

Flickable {
anchors.fill: parent
contentWidth: parent.width
Expand Down
2 changes: 1 addition & 1 deletion android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="com.volla.launcher" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="4.1.3" android:versionCode="443" android:installLocation="auto">
<manifest package="com.volla.launcher" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="4.1.4" android:versionCode="444" android:installLocation="auto">
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="29"/>

<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Expand Down
11 changes: 11 additions & 0 deletions android/src/com/volla/launcher/activity/ReceiveTextActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.fonts.SystemFonts;
import android.graphics.fonts.Font;
import android.util.Log;
import android.os.Bundle;
import android.os.Build;
Expand All @@ -30,6 +32,8 @@
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Set;
import java.io.ByteArrayOutputStream;
import androidnative.SystemDispatcher;
import androidnative.AndroidNativeActivity;
Expand Down Expand Up @@ -97,6 +101,13 @@ public void onCreate (Bundle savedInstanceState) {

Log.d(TAG, "onCreated() called");

// Set<Font> sfs = SystemFonts.getAvailableFonts();
// Iterator<Font> fontIterator = sfs.iterator();
// while(fontIterator.hasNext()) {
// Font f = fontIterator.next();
// Log.d(TAG, "Font: " + f.getFile());
// }

// Workaround for blank activity
// https://forum.qt.io/topic/90189/android-e-qt-java-surface-1-not-found/2
if (instance != null) {
Expand Down
19 changes: 19 additions & 0 deletions android/src/com/volla/launcher/util/LayoutUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class LayoutUtil {
public static final String SET_COLOR = "volla.launcher.colorAction";
public static final String GET_NAVBAR_HEIGHT = "volla.launcher.navBarAction";
public static final String GOT_NAVBAR_HEIGHT = "volla.launcher.navBarResponse";
public static final String GET_SYSTEM_FONT = "volla.launcher.fontAction";
public static final String GOT_SYSTEM_FONT = "volla.launcher.fontResponse";

static {
SystemDispatcher.addListener(new SystemDispatcher.Listener() {
Expand Down Expand Up @@ -150,6 +152,23 @@ public void run() {
};

activity.runOnUiThread(runnable);
} else if (type.equals(GET_SYSTEM_FONT)) {
final Activity activity = QtNative.activity();

Runnable runnable = new Runnable () {
public void run() {
int resId = Resources.getSystem().getIdentifier("config_bodyFontFamily", "string", "android");
String systemFont;
if (resId == 0) systemFont = "";
else systemFont = Resources.getSystem().getString(resId);
Map responseMessage = new HashMap();
responseMessage.put("font", systemFont);
SystemDispatcher.dispatch(GOT_SYSTEM_FONT, responseMessage);
}
};

Thread thread = new Thread(runnable);
thread.start();
} else if (type.equals(GET_NAVBAR_HEIGHT)) {
final Activity activity = QtNative.activity();

Expand Down
29 changes: 20 additions & 9 deletions main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ ApplicationWindow {
if (mainView.isTablet) AN.SystemDispatcher.dispatch("volla.launcher.runningAppsAction", {})
// Start onboarding for the first start of the app
console.log("MainView | First start: " + settings.firstStart)
// Check system fint
AN.SystemDispatcher.dispatch("volla.launcher.fontAction", {})
// Check new pinned shortcut
AN.SystemDispatcher.dispatch("volla.launcher.checkNewShortcut", {})
// Update app grid
Expand Down Expand Up @@ -589,7 +591,7 @@ ApplicationWindow {
if (settings.sync) {
settings.sync()
}
console.log("MainView | Swith theme to " + theme + ", " + settings.theme)
console.log("MainView | Switch theme to " + theme + ", " + settings.theme)
switch (theme) {
case mainView.theme.Dark:
Universal.theme = Universal.Dark
Expand All @@ -608,7 +610,7 @@ ApplicationWindow {
mainView.backgroundOpacity = 0.3
mainView.backgroundColor = "transparent"
mainView.fontColor = "white"
break
break
case mainView.theme.LightTranslucent:
Universal.theme = Universal.Light
mainView.backgroundOpacity = 0.3
Expand Down Expand Up @@ -1198,6 +1200,7 @@ ApplicationWindow {
console.log("MainView | Invalid RSS feed url")
}
} else if (type === "volla.launcher.uiModeResponse") {
console.debug("MainView | volla.launcher.uiModeResponse")
mainView.switchTheme(message["uiMode"], false)
} else if (type === "volla.launcher.messageResponse") {
console.log("MainView | onDispatched: " + type)
Expand All @@ -1208,21 +1211,27 @@ ApplicationWindow {
mainView.showToast(qsTr(mainView.notifications[message["text"]]))
}
} else if (type === "volla.launcher.uiModeChanged") {
console.debug("MainView | volla.launcher.uiModeChanged")
if (message["uiMode"] !== settings.theme) {
settings.theme = message["uiMode"]
settings.sync()
if (message["uiMode"] === mainView.theme.Light) {
if (settings.theme === mainView.theme.LightTranslucent || settings.theme === mainView.theme.DarkTranslucent) {
if (settings.theme === mainView.theme.DarkTranslucent) {
mainView.switchTheme(mainView.theme.LightTranslucent, false)
} else {
settings.theme = mainView.theme.LightTranslucent
settings.sync()
} else if (settings.theme === mainView.theme.Dark) {
mainView.switchTheme(mainView.theme.Light, true)
settings.theme = mainView.theme.Light
settings.sync()
}

} else if (message["uiMode"] === mainView.theme.Dark) {
if (settings.theme === mainView.theme.LightTranslucent || settings.theme === mainView.theme.DarkTranslucent) {
if (settings.theme === mainView.theme.LightTranslucent) {
mainView.switchTheme(mainView.theme.DarkTranslucent, false)
} else {
settings.theme = mainView.theme.DarkTranslucent
settings.sync()
} else if (settings.theme === mainView.theme.Light) {
mainView.switchTheme(mainView.theme.Dark, true)
settings.theme = mainView.theme.Dark
settings.sync()
}
}
}
Expand All @@ -1238,6 +1247,8 @@ ApplicationWindow {
var object = component.createObject(mainView, properties)
object.open()
}
} else if (type === "volla.launcher.fontResponse") {
console.debug("MainView | System font: " + message["font"])
}
}
}
Expand Down
Loading