Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #215

Merged
merged 3 commits into from
Apr 14, 2024
Merged

Dev #215

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
1 change: 1 addition & 0 deletions Collections.qml
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,7 @@ LauncherPage {
kind = "Signal"
}

cThread.c_SBADGE = thread["read"] === "true" ? false : true
cThread.c_STEXT = mainView.parseTime(Number(thread["date"])) + " • " + qsTr(kind)
cThread.c_TSTAMP = Number(thread["date"])

Expand Down
70 changes: 70 additions & 0 deletions SttSetup.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import QtQuick 2.0
import QtQuick.Controls 2.5
import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.2
import QtQuick.Controls.Universal 2.12
import QtGraphicalEffects 1.12
import AndroidNative 1.0 as AN

Dialog {
id: dialog
anchors.centerIn: Overlay.overlay
height: 240
width: 260
padding: dialog.innerSpacing
focus: true
modal: true
dim: false
closePolicy: Popup.NoAutoClose
standardButtons: Dialog.Cancel | Dialog.Ok

property var fontSize
property int innerSpacing

enter: Transition {
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}

exit: Transition {
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}

background: Item {
ShaderEffectSource {
id: effectSource
sourceItem: mainView
anchors.fill: parent
sourceRect: Qt.rect(popup.x,popup.y,popup.width,popup.height)
}
FastBlur{
id: blur
anchors.fill: effectSource
source: effectSource
radius: 32
}
Rectangle {
anchors.fill: parent
color: "#2e2e2e"
border.color: "transparent"
opacity: 0.6
}
}

contentItem: Text {
anchors.fill: dialog
text: qsTr("Now set up voice recognition for text input, which you can then activate using the microphone icon on the keyboard.")
color: Universal.foreground
wrapMode: Text.WordWrap
font.pointSize: dialog.fontSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}

onAccepted: {
AN.SystemDispatcher.dispatch("volla.launcher.checkSttAvailability", {})
}

onRejected: {
dialog.close()
}
}
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="2.3.3" android:versionCode="294" android:installLocation="auto">
<manifest package="com.volla.launcher" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.3.4" android:versionCode="295" 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
54 changes: 54 additions & 0 deletions android/src/com/volla/launcher/util/AppUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.telecom.TelecomManager;
import android.content.Context;
import android.net.Uri;
import android.speech.RecognizerIntent;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -48,6 +49,7 @@ public class AppUtil {
public static final String GOT_SECURITY_STATE = "volla.launcher.securityStateResponse";
public static final String GET_IS_SECURITY_PW_SET = "volla.launcher.checkSecurityPasswordAction";
public static final String GOT_IS_SECURITY_PW_SET = "volla.launcher.checkSecurityPasswordResponse";
public static final String GET_IS_STT_AVAILABLE = "volla.launcher.checkSttAvailability";

static {
SystemDispatcher.addListener(new SystemDispatcher.Listener() {
Expand Down Expand Up @@ -244,6 +246,58 @@ public void run() {
Map reply = new HashMap();
reply.put("isPasswordSet", childModeManager.isPasswortSet() );
SystemDispatcher.dispatch(GOT_IS_SECURITY_PW_SET, reply);
} else if (type.equals(GET_IS_STT_AVAILABLE)) {
Intent speechIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
List<ResolveInfo> speechActivities = pm.queryIntentActivities(speechIntent, 0);
Log.d(TAG, "STT activities: " + speechActivities.size());
if (speechActivities.size() == 0) { //we have a microphone
PackageInfo pi;
String packageName = "com.volla.vollaboard";
try {
pi = activity.getPackageManager().getPackageInfo(packageName, 0);
Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null);
resolveIntent.setPackage(pi.packageName);
List<ResolveInfo> apps = pm.queryIntentActivities(resolveIntent, 0);
for (ResolveInfo app: apps){
Log.d(TAG,String.format("%s %s",app.activityInfo.packageName,app.activityInfo.name));
packageName = app.activityInfo.packageName;
String className = app.activityInfo.name;
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ComponentName cn = new ComponentName(packageName, className);
intent.setComponent(cn);
try {
activity.startActivity(intent);
} catch (SecurityException se){
Log.e(TAG, "Security exception: " + se.getMessage());
}
}
} catch (PackageManager.NameNotFoundException nnfe) {
Log.e(TAG, "Package Name not found: " + nnfe.getMessage() + ", App is not installed.");
}
try {
pi = activity.getPackageManager().getPackageInfo(packageName, 0);
Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null);
resolveIntent.setPackage(pi.packageName);
List<ResolveInfo> apps = pm.queryIntentActivities(resolveIntent, 0);
for (ResolveInfo app: apps){
Log.d(TAG,String.format("%s %s",app.activityInfo.packageName,app.activityInfo.name));
packageName = app.activityInfo.packageName;
String className = app.activityInfo.name;
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ComponentName cn = new ComponentName(packageName, className);
intent.setComponent(cn);
try {
activity.startActivity(intent);
} catch (SecurityException se){
Log.e(TAG, "Security exception: " + se.getMessage());
}
}
} catch (PackageManager.NameNotFoundException nnfe) {
Log.e(TAG, "Package Name not found: " + nnfe.getMessage() + ", App is not installed.");
}
}
}
}
};
Expand Down
12 changes: 12 additions & 0 deletions main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ ApplicationWindow {
var object = component.createObject(mainView, properties)
object.open()
settings.firstStart = false
} else if (!settings.sttchecked) {
console.debug("MainView", "Will start stt dialog")
settings.sttChecked = true
component = Qt.createComponent("/SttSetup.qml")
properties = { "fontSize" : 18, "innerSpacing" : 22 }
if (component.status !== Component.Ready) {
if (component.status === Component.Error)
console.debug("MainView | Error: "+ component.errorString() );
}
object = component.createObject(mainView, properties)
object.open()
}
// Check new pinned shortcut
AN.SystemDispatcher.dispatch("volla.launcher.checkNewShortcut", {})
Expand Down Expand Up @@ -1052,6 +1063,7 @@ ApplicationWindow {
property int searchMode: mainView.searchMode.StartPage
property bool fullscreen: false
property bool firstStart: true
property bool sttChecked: false
property bool signalIsActivated: false
property bool useColoredIcons: false
property bool showAppsAtStartup: false
Expand Down
6 changes: 1 addition & 5 deletions qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@
<file>Shortcut.qml</file>
<file>Springboard.qml</file>
<file>qtquickcontrols2.conf</file>

<file>scripts/apps.mjs</file>
<file>scripts/contacts.mjs</file>
<file>scripts/springboard.mjs</file>

<file>android/res/drawable/wallpaper_image.png</file>

<file>icons/amazon@4x.png</file>
<file>icons/argenta@4x.png</file>
<file>icons/attachment@4x.png</file>
Expand Down Expand Up @@ -98,11 +94,11 @@
<file>icons/woolsocks@4x.png</file>
<file>icons/xmpp@4x_104x104px.png</file>
<file>icons/yalp-store@4x.png</file>

<file>images/contact-mask.png</file>
<file>images/open-in-signal_dark@2x.png</file>
<file>images/open-in-signal_dark_2x.png</file>
<file>images/open-in-signal_light@2x.png</file>
<file>images/open-in-signal_light_2x.png</file>
<file>SttSetup.qml</file>
</qresource>
</RCC>
7 changes: 7 additions & 0 deletions translations/Volla_be.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,13 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SttSetup</name>
<message>
<source>Now set up voice recognition for text input, which you can then activate using the microphone icon on the keyboard.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
Expand Down
7 changes: 7 additions & 0 deletions translations/Volla_bg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,13 @@
<translation type="unfinished">Моля, нулирайте контактите и опитайте отново.</translation>
</message>
</context>
<context>
<name>SttSetup</name>
<message>
<source>Now set up voice recognition for text input, which you can then activate using the microphone icon on the keyboard.</source>
<translation type="unfinished">Сега настройте гласовото разпознаване за въвеждане на текст, което можете да активирате чрез иконата на микрофона върху клавиатурата.</translation>
</message>
</context>
<context>
<name>main</name>
<message>
Expand Down
7 changes: 7 additions & 0 deletions translations/Volla_cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,13 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SttSetup</name>
<message>
<source>Now set up voice recognition for text input, which you can then activate using the microphone icon on the keyboard.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
Expand Down
7 changes: 7 additions & 0 deletions translations/Volla_cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,13 @@
<translation type="unfinished">Obnovte prosím kontakty a zkuste to znovu.</translation>
</message>
</context>
<context>
<name>SttSetup</name>
<message>
<source>Now set up voice recognition for text input, which you can then activate using the microphone icon on the keyboard.</source>
<translation type="unfinished">Nyní nastavte rozpoznávání hlasu pro zadávání textu, které můžete aktivovat pomocí symbolu mikrofonu na klávesnici.</translation>
</message>
</context>
<context>
<name>main</name>
<message>
Expand Down
Loading