diff --git a/src/android/full/com/iktwo/qutelauncher/CustomFirebaseMessagingService.java b/src/android/full/com/iktwo/qutelauncher/CustomFirebaseMessagingService.java index d9c22cf..7a6b874 100644 --- a/src/android/full/com/iktwo/qutelauncher/CustomFirebaseMessagingService.java +++ b/src/android/full/com/iktwo/qutelauncher/CustomFirebaseMessagingService.java @@ -10,14 +10,14 @@ public class CustomFirebaseMessagingService extends FirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage remoteMessage) { - Log.d(TAG, "From: " + remoteMessage.getFrom()); + // Log.d(TAG, "From: " + remoteMessage.getFrom()); if (remoteMessage.getData().size() > 0) { - Log.d(TAG, "Message data payload: " + remoteMessage.getData()); + // Log.d(TAG, "Message data payload: " + remoteMessage.getData()); } if (remoteMessage.getNotification() != null) { - Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody()); + // Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody()); } } } diff --git a/src/android/full/com/iktwo/qutelauncher/QuteLauncherFlavored.java b/src/android/full/com/iktwo/qutelauncher/QuteLauncherFlavored.java index ee77e34..ed84983 100755 --- a/src/android/full/com/iktwo/qutelauncher/QuteLauncherFlavored.java +++ b/src/android/full/com/iktwo/qutelauncher/QuteLauncherFlavored.java @@ -5,12 +5,12 @@ import com.google.firebase.analytics.FirebaseAnalytics; public class QuteLauncherFlavored extends QuteLauncher { - private FirebaseAnalytics mFirebaseAnalytics; + private FirebaseAnalytics firebaseAnalytics; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); + firebaseAnalytics = FirebaseAnalytics.getInstance(this); } } diff --git a/src/android/src/com/iktwo/qutelauncher/PackageChangedReceiver.java b/src/android/src/com/iktwo/qutelauncher/PackageChangedReceiver.java index aa5d2f4..06c5ede 100755 --- a/src/android/src/com/iktwo/qutelauncher/PackageChangedReceiver.java +++ b/src/android/src/com/iktwo/qutelauncher/PackageChangedReceiver.java @@ -13,7 +13,6 @@ public void onReceive(final Context context, Intent intent) { final String packageName = intent.getData().getSchemeSpecificPart(); if (packageName == null || packageName.length() == 0) { - // they sent us a bad intent return; } diff --git a/src/android/src/com/iktwo/qutelauncher/QuteLauncher.java b/src/android/src/com/iktwo/qutelauncher/QuteLauncher.java index eec82f6..5893b77 100755 --- a/src/android/src/com/iktwo/qutelauncher/QuteLauncher.java +++ b/src/android/src/com/iktwo/qutelauncher/QuteLauncher.java @@ -88,11 +88,8 @@ public static void launchApplication(String packageName) { } public static byte[] getApplicationIcon(String packageName) { - // Log.d(TAG, "TRYING TO GET ICON FOR: " + packageName); - Drawable icon; - /// Get application icon try { ApplicationInfo app = mPm.getApplicationInfo(packageName, 0); Resources resources = mPm.getResourcesForApplication(app); diff --git a/src/qml/IntroView.qml b/src/qml/IntroView.qml index 3ae8c2a..03e1928 100644 --- a/src/qml/IntroView.qml +++ b/src/qml/IntroView.qml @@ -110,9 +110,17 @@ FocusScope { maximumFlickVelocity: width * 2 delegate: Item { + property int parentIndex: listView.currentIndex + height: ListView.view.height width: ListView.view.width + onParentIndexChanged: { + if (parentIndex === index + 1) { + loader.item.next() + } + } + Loader { id: loader diff --git a/src/qml/components/RadioButtonStyleDefault.qml b/src/qml/components/RadioButtonStyleDefault.qml new file mode 100644 index 0000000..eefdfb0 --- /dev/null +++ b/src/qml/components/RadioButtonStyleDefault.qml @@ -0,0 +1,32 @@ +import QtQuick 2.6 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import com.iktwo.qutelauncher 1.0 as QL + +RadioButtonStyle { + label: Label { + text: control.text + color: "#ffffff" + } + + indicator: Rectangle { + implicitWidth: QL.ScreenValues.dp * 16 + implicitHeight: QL.ScreenValues.dp * 16 + radius: QL.ScreenValues.dp * 9 + border { + color: control.activeFocus ? "darkblue" : "gray" + width: QL.ScreenValues.dp * 1 + } + + Rectangle { + anchors { + fill: parent + margins: QL.ScreenValues.dp * 4 + } + + visible: control.checked + color: "#555" + radius: QL.ScreenValues.dp * 9 + } + } +} diff --git a/src/qml/components/qmldir b/src/qml/components/qmldir index d4b5d9c..dc7ccb4 100644 --- a/src/qml/components/qmldir +++ b/src/qml/components/qmldir @@ -1,2 +1,3 @@ MenuItem 1.0 MenuItem.qml +RadioButtonStyleDefault 1.0 RadioButtonStyleDefault.qml PressAndHoldMenu 1.0 PressAndHoldMenu.qml diff --git a/src/qml/intro/IntroEnd.qml b/src/qml/intro/IntroEnd.qml index 67eacb4..d21f066 100644 --- a/src/qml/intro/IntroEnd.qml +++ b/src/qml/intro/IntroEnd.qml @@ -2,15 +2,14 @@ import QtQuick 2.6 import QtQuick.Controls 1.4 import com.iktwo.qutelauncher 1.0 as QL -Item { +IntroScreen { id: root - signal done - Button { anchors.centerIn: parent - text: "DONE" + text: qsTr("DONE") + onClicked: root.done() } } diff --git a/src/qml/intro/IntroMain.qml b/src/qml/intro/IntroMain.qml index 5d9c7a2..08060c2 100644 --- a/src/qml/intro/IntroMain.qml +++ b/src/qml/intro/IntroMain.qml @@ -2,7 +2,7 @@ import QtQuick 2.6 import QtQuick.Controls 1.4 import com.iktwo.qutelauncher 1.0 as QL -Item { +IntroScreen { Column { anchors { diff --git a/src/qml/intro/IntroScreen.qml b/src/qml/intro/IntroScreen.qml new file mode 100644 index 0000000..436b7aa --- /dev/null +++ b/src/qml/intro/IntroScreen.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import Qt.labs.settings 1.0 +import com.iktwo.qutelauncher 1.0 as QL +import components 1.0 as C + +FocusScope { + signal done + signal next +} diff --git a/src/qml/intro/IntroSelection.qml b/src/qml/intro/IntroSelection.qml new file mode 100644 index 0000000..759b6c8 --- /dev/null +++ b/src/qml/intro/IntroSelection.qml @@ -0,0 +1,39 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import Qt.labs.settings 1.0 +import com.iktwo.qutelauncher 1.0 as QL +import components 1.0 as C + +IntroScreen { + Column { + anchors.centerIn: parent + + Repeater { + id: repeater + + model: ["Classic", "Tiles"] + + RadioButton { + text: modelData + checked: index === 0 + + style: C.RadioButtonStyleDefault { } + + exclusiveGroup: exclusiveGroupTheme + } + } + } + + Settings { + id: settings + + property string theme: repeater.model[0].toLowerCase() + } + + ExclusiveGroup { + id: exclusiveGroupTheme + } + + onNext: settings.theme = exclusiveGroupTheme.current.text.toLowerCase() +} diff --git a/src/qml/main.qml b/src/qml/main.qml index a9d3f47..e769f0e 100755 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -1,6 +1,7 @@ import QtQuick 2.5 import QtQuick.Controls 1.4 import QtQuick.Window 2.2 +import Qt.labs.settings 1.0 import com.iktwo.qutelauncher 1.0 as QL import config 1.0 as Config import debug 1.0 as D @@ -24,6 +25,8 @@ ApplicationWindow { property bool activeScreen: Qt.application.state === Qt.ApplicationActive + property string currentTheme + function updatePortraitMode() { if (height >= width) Config.Theme.portrait = true @@ -63,50 +66,38 @@ ApplicationWindow { Config.Theme.tablet = QL.ScreenValues.isTablet } - FocusScope { - id: keyHandler - - height: 1 - width: 1 - - focus: true + Timer { + interval: 550 + running: true - Keys.onBackPressed: { - if (loaderMainTheme.item && loaderMainTheme.item.opened) { - QL.Launcher.minimize() - } + onTriggered: { + QL.Launcher.registerMethods() + QL.PackageManager.registerBroadcast() } + } - Keys.onUpPressed: { - if (Qt.platform.os !== "android") - explandableItem.open() - - event.accepted = false - } + Component { + id: componentSettings - Keys.onDownPressed: { - if (Qt.platform.os !== "android") - explandableItem.close() + Item { - event.accepted = false } } - Timer { - interval: 550 - running: true + Settings { + property string theme - onTriggered: { - QL.Launcher.registerMethods() - QL.PackageManager.registerBroadcast() - } + onThemeChanged: currentTheme = theme } Loader { id: loaderMainTheme anchors.fill: parent - source: "themes/classic/ThemeMain.qml" + + focus: true + + source: currentTheme !== "" ? ("themes/" + currentTheme + "/ThemeMain.qml") : undefined } Loader { @@ -118,7 +109,15 @@ ApplicationWindow { anchors.fill: parent - sourceComponent: !QL.ApplicationInfo.hasShownInitialDialog ? introView : undefined + sourceComponent: !QL.ApplicationInfo.hasShownInitialDialog ? introView : componentSettings + + focus: true + + Keys.onBackPressed: { + if (loaderMainTheme.item && loaderMainTheme.item.opened) { + QL.Launcher.minimize() + } + } Component { id: introView @@ -129,21 +128,19 @@ ApplicationWindow { statusbarMargin: QL.ScreenValues.statusBarHeight navbarMargin: QL.ScreenValues.navBarVisible ? QL.ScreenValues.navigationBarHeight : 0 - // enabled: false - // visible: false - model: ListModel { ListElement { name: "IntroMain.qml"; backgroundColor: "#424242" } - ListElement { name: "IntroEnd.qml"; backgroundColor: "#2c3e50" } + ListElement { name: "IntroSelection.qml"; backgroundColor: "#2c3e50" } + ListElement { name: "IntroEnd.qml"; backgroundColor: "#424242" } } onDone: { QL.ApplicationInfo.hasShownInitialDialog = true loader.unload() + loader.sourceComponent = componentSettings } } } - } Image { diff --git a/src/qml/themes/classic/ThemeMain.qml b/src/qml/themes/classic/ThemeMain.qml index 6dd5022..fa50c8e 100644 --- a/src/qml/themes/classic/ThemeMain.qml +++ b/src/qml/themes/classic/ThemeMain.qml @@ -1,7 +1,7 @@ import QtQuick 2.0 import com.iktwo.qutelauncher 1.0 as QL -Item { +FocusScope { id: root property int navbarMargin: QL.ScreenValues.navBarVisible ? QL.ScreenValues.navigationBarHeight : 0 @@ -9,6 +9,22 @@ Item { property bool opened: explandableItem.isOpened + focus: true + + Keys.onUpPressed: { + if (Qt.platform.os !== "android") + explandableItem.open() + + event.accepted = false + } + + Keys.onDownPressed: { + if (Qt.platform.os !== "android") + explandableItem.close() + + event.accepted = false + } + MouseArea { anchors.fill: parent diff --git a/src/qml/themes/tiles/ApplicationList.qml b/src/qml/themes/tiles/ApplicationList.qml index e128e4e..2a1c0d3 100644 --- a/src/qml/themes/tiles/ApplicationList.qml +++ b/src/qml/themes/tiles/ApplicationList.qml @@ -29,7 +29,7 @@ Item { bottom: parent.bottom } - cacheBuffer: height * 9 + cacheBuffer: height >= 0 ? (height * 9) : root.height maximumFlickVelocity: root.height * 2.5 section { @@ -133,6 +133,7 @@ Item { Image { anchors.fill: parent + antialiasing: true /// TODO: verify this source: "qrc:/images/menu" diff --git a/src/resources.qrc b/src/resources.qrc index 051058f..18a71b5 100755 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -26,6 +26,9 @@ qml/components/qmldir qml/themes/classic/ApplicationGridMenu.qml qml/components/MenuItem.qml + qml/intro/IntroSelection.qml + qml/components/RadioButtonStyleDefault.qml + qml/intro/IntroScreen.qml resources/images/test.png