Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
石璀亮
/
turingos
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 45a84f71
authored
Sep 10, 2019
by
cuiliang.shi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v1.0
1 parent
8210ae26
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
30 deletions
app/build.gradle
app/src/main/AndroidManifest.xml
app/src/main/java/com/toscl/turingos/MainActivity.java
app/src/main/java/com/toscl/turingos/util/SkillsSlotUtil.java
app/build.gradle
View file @
45a84f7
...
@@ -15,8 +15,8 @@ android {
...
@@ -15,8 +15,8 @@ android {
applicationId
"com.toscl.turingos"
applicationId
"com.toscl.turingos"
minSdkVersion
15
minSdkVersion
15
targetSdkVersion
22
targetSdkVersion
22
versionCode
9
versionCode
10
versionName
"
0.9
"
versionName
"
1.0
"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
ndk
{
ndk
{
...
...
app/src/main/AndroidManifest.xml
View file @
45a84f7
...
@@ -41,11 +41,11 @@
...
@@ -41,11 +41,11 @@
android:theme=
"@style/AppTheme.Launcher"
android:theme=
"@style/AppTheme.Launcher"
android:name=
"com.toscl.turingos.MainActivity"
android:name=
"com.toscl.turingos.MainActivity"
android:screenOrientation=
"portrait"
>
android:screenOrientation=
"portrait"
>
<!--
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
-->
</intent-filter>
</activity>
</activity>
<meta-data
<meta-data
...
...
app/src/main/java/com/toscl/turingos/MainActivity.java
View file @
45a84f7
...
@@ -138,6 +138,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
...
@@ -138,6 +138,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
"按下OK键给我指令,你可以和我说:\"来首好听的歌。\""
,
"按下OK键给我指令,你可以和我说:\"来首好听的歌。\""
,
"按下OK键给我指令,你可以和我说:\"101乘以125等于多少。\""
,
"按下OK键给我指令,你可以和我说:\"101乘以125等于多少。\""
,
"按下OK键给我指令,你可以和我说:\"定一个早上8点的闹钟。\""
,
"按下OK键给我指令,你可以和我说:\"定一个早上8点的闹钟。\""
,
"如果正在游戏中需要给我指令,你可以先和我说:\"退出。\""
,
};
};
int
index
=
(
int
)
(
Math
.
random
()*(
helpInfo
.
length
-
1
));
int
index
=
(
int
)
(
Math
.
random
()*(
helpInfo
.
length
-
1
));
...
@@ -146,9 +147,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
...
@@ -146,9 +147,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
.
setContentText
(
helpInfo
[
index
]);
.
setContentText
(
helpInfo
[
index
]);
mGlobalDialog
.
show
();
mGlobalDialog
.
show
();
mGlobalDialog
.
findViewById
(
R
.
id
.
confirm_button
).
setOnClickListener
(
new
View
.
On
ClickListener
()
{
mGlobalDialog
.
setConfirmClickListener
(
new
SweetAlertDialog
.
OnSweet
ClickListener
()
{
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
SweetAlertDialog
sDialog
)
{
operateAll
();
operateAll
();
}
}
});
});
...
@@ -193,12 +194,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
...
@@ -193,12 +194,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
AppAndContactsBean
appAndContactsBean
=
new
AppAndContactsBean
();
AppAndContactsBean
appAndContactsBean
=
new
AppAndContactsBean
();
if
(!
PreferencesUtil
.
getInstance
(
mContext
).
getBoolean
(
"is_uploaded_phone_info"
,
false
))
{
//
if (!PreferencesUtil.getInstance(mContext).getBoolean("is_uploaded_phone_info", false)) {
Map
<
String
,
String
>
appMap
=
SkillsSlotUtil
.
queryFilterAppInfo
(
MainActivity
.
this
);
Map
<
String
,
String
>
appMap
=
SkillsSlotUtil
.
queryFilterAppInfo
(
MainActivity
.
this
);
appAndContactsBean
.
setAppsMap
(
appMap
);
appAndContactsBean
.
setAppsMap
(
appMap
);
}
//
}
Map
<
String
,
String
>
contactMap
=
SkillsSlotUtil
.
getContacts
(
mContext
);
Map
<
String
,
String
>
contactMap
=
SkillsSlotUtil
.
getContacts
(
mContext
);
appAndContactsBean
.
setContactMap
(
contactMap
);
appAndContactsBean
.
setContactMap
(
contactMap
);
...
@@ -584,7 +585,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
...
@@ -584,7 +585,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
}
}
public
void
handleTtsResultCode
(
Behavior
.
IntentInfo
intent
,
Context
context
)
{
public
int
handleTtsResultCode
(
Behavior
.
IntentInfo
intent
,
Context
context
)
{
Log
.
d
(
TAG
,
"handleTtsResultCode"
+
intent
.
getCode
());
Log
.
d
(
TAG
,
"handleTtsResultCode"
+
intent
.
getCode
());
switch
(
intent
.
getCode
())
{
switch
(
intent
.
getCode
())
{
case
200101
:
case
200101
:
...
@@ -668,8 +669,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
...
@@ -668,8 +669,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
}
}
break
;
break
;
default
:
default
:
break
;
return
0
;
}
}
return
1
;
}
}
private
Handler
mLoadToastHandler
=
new
Handler
(){
private
Handler
mLoadToastHandler
=
new
Handler
(){
...
@@ -766,18 +768,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
...
@@ -766,18 +768,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
Log
.
d
(
TAG
,
"ttsSequenceList onSpeakBegin s.length:"
+
s
.
length
());
Log
.
d
(
TAG
,
"ttsSequenceList onSpeakBegin s.length:"
+
s
.
length
());
// mResultText.setSelection(mResultText.getText().length(), mResultText.getText().length());
// mResultText.setSelection(mResultText.getText().length(), mResultText.getText().length());
if
(
isMusic
(
intent
)
&&
intent
!=
null
&&
intent
.
getParameters
()
!=
null
)
{
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
"name"
,
intent
.
getParameters
().
get
(
"name"
).
getAsString
());
if
(
intent
.
getParameters
().
get
(
"url"
)
!=
null
)
{
bundle
.
putString
(
"url"
,
intent
.
getParameters
().
get
(
"url"
).
getAsString
());
}
Message
message
=
new
Message
();
message
.
setData
(
bundle
);
message
.
what
=
MusicHandler
.
MSG_MIGU_SEARCH
;
musicHandler
.
sendMessage
(
message
);
}
checkMusic
(
behavior
.
getIntent
());
}
}
@Override
@Override
...
@@ -792,13 +782,29 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
...
@@ -792,13 +782,29 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
@Override
@Override
public
void
onSpeakCompleted
()
{
public
void
onSpeakCompleted
()
{
mUiHandler
.
sendEmptyMessage
(
0
);
handleTtsResultCode
(
intent
,
MainActivity
.
this
);
Log
.
d
(
TAG
,
"ttsSequenceList complete"
);
Log
.
d
(
TAG
,
"ttsSequenceList complete"
);
mUiHandler
.
sendEmptyMessage
(
0
);
int
result
=
handleTtsResultCode
(
intent
,
getApplicationContext
());
if
(
result
==
0
){
checkMusic
(
behavior
.
getIntent
());
}
/* if (isMusic(intent) && intent != null && intent.getParameters() != null) {
Bundle bundle = new Bundle();
bundle.putString("name", intent.getParameters().get("name").getAsString());
if (intent.getParameters().get("url") != null) {
bundle.putString("url", intent.getParameters().get("url").getAsString());
}
Message message = new Message();
message.setData(bundle);
message.what = MusicHandler.MSG_MIGU_SEARCH;
musicHandler.sendMessage(message);
}*/
// checkMusic(behavior.getIntent());
/*
if (isMusic(intent) || isMedia(intent)) {
if (isMusic(intent) || isMedia(intent)) {
musicHandler.sendEmptyMessage(MusicHandler.MSG_TTS_FINISH);
musicHandler.sendEmptyMessage(MusicHandler.MSG_TTS_FINISH);
return;
return;
}
}
*/
}
}
@Override
@Override
...
@@ -1092,7 +1098,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
...
@@ -1092,7 +1098,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
private
TuringOsService
osService
;
private
TuringOsService
osService
;
private
long
mClickTime
=
0
;
public
void
operateAll
()
{
public
void
operateAll
()
{
if
((
System
.
currentTimeMillis
()
-
mClickTime
)
<
500
){
return
;
}
mClickTime
=
System
.
currentTimeMillis
();
Log
.
d
(
TAG
,
"operateAll"
);
Log
.
d
(
TAG
,
"operateAll"
);
mLoadToast
.
setText
(
"正在倾听中..."
);
mLoadToast
.
setText
(
"正在倾听中..."
);
...
@@ -1303,19 +1314,25 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
...
@@ -1303,19 +1314,25 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
return
;
return
;
}
}
final
String
finalMediaUrl
=
mediaUrl
;
final
String
finalMediaUrl
=
mediaUrl
;
runOnUiThread
(
new
Runnable
()
{
Message
msg
=
new
Message
();
msg
.
arg1
=
0
;
msg
.
obj
=
finalMediaUrl
;
mMusicDelay
.
sendMessageAtTime
(
msg
,
1000
);
/*runOnUiThread(new Runnable() {
@Override
@Override
public void run() {
public void run() {
startMusic(finalMediaUrl);
startMusic(finalMediaUrl);
/* Bundle bundle = new Bundle();
*/
/* Bundle bundle = new Bundle();
bundle.putString("url", finalMediaUrl);
bundle.putString("url", finalMediaUrl);
Message message = new Message();
Message message = new Message();
message.setData(bundle);
message.setData(bundle);
message.what = MusicHandler.MSG_PREPARE_TURING;
message.what = MusicHandler.MSG_PREPARE_TURING;
musicHandler.sendMessage(message);
musicHandler.sendMessage(message);
setMusicView(true);*/
setMusicView(true);*/
/*
}
}
});
});
*/
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
Log
.
e
(
TAG
,
" parse exception"
);
Log
.
e
(
TAG
,
" parse exception"
);
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
app/src/main/java/com/toscl/turingos/util/SkillsSlotUtil.java
View file @
45a84f7
...
@@ -129,7 +129,6 @@ public class SkillsSlotUtil {
...
@@ -129,7 +129,6 @@ public class SkillsSlotUtil {
appMap
.
put
(
"音乐播放器"
,
"com.android.music/com.android.music.MusicBrowserActivity"
);
appMap
.
put
(
"音乐播放器"
,
"com.android.music/com.android.music.MusicBrowserActivity"
);
appMap
.
put
(
"紧急呼叫"
,
"com.android.sos/com.android.sos.SosActivity"
);
appMap
.
put
(
"紧急呼叫"
,
"com.android.sos/com.android.sos.SosActivity"
);
appMap
.
put
(
"亲情号码"
,
"com.sprd.simple.launcher/com.nb.dq.family.FamilyActivity"
);
appMap
.
put
(
"亲情号码"
,
"com.sprd.simple.launcher/com.nb.dq.family.FamilyActivity"
);
appMap
.
put
(
"通话记录"
,
"com.sprd.simple.launcher/dx.com.contactforlaunch.ui.CallCenterActivity"
);
appMap
.
put
(
"相机"
,
"com.mediatek.camera/com.mediatek.camera.CameraLauncher"
);
appMap
.
put
(
"相机"
,
"com.mediatek.camera/com.mediatek.camera.CameraLauncher"
);
appMap
.
put
(
"最美天气"
,
"com.icoolme.android.weather"
);
appMap
.
put
(
"最美天气"
,
"com.icoolme.android.weather"
);
...
@@ -138,6 +137,17 @@ public class SkillsSlotUtil {
...
@@ -138,6 +137,17 @@ public class SkillsSlotUtil {
appMap
.
put
(
"拨号"
,
"com.sprd.simple.launcher/com.nb.dq.calllog.CallDialpadActivity"
);
appMap
.
put
(
"拨号"
,
"com.sprd.simple.launcher/com.nb.dq.calllog.CallDialpadActivity"
);
appMap
.
put
(
"电话"
,
"com.sprd.simple.launcher/com.nb.dq.calllog.CallDialpadActivity"
);
appMap
.
put
(
"电话"
,
"com.sprd.simple.launcher/com.nb.dq.calllog.CallDialpadActivity"
);
Log
.
d
(
TAG
,
"android.os.Build.VERSION.RELEASE: "
+
android
.
os
.
Build
.
VERSION
.
RELEASE
);
if
(
"4.4.4"
.
equals
(
android
.
os
.
Build
.
VERSION
.
RELEASE
)){
// appMap.put("工具箱", "com.sprd.simple.launcher/com.nb.dq.folder.FolderActivity");
// appMap.put("所有应用", "com.sprd.simple.launcher/com.nb.dq.folder.AppListActivity");
appMap
.
put
(
"短信"
,
"com.android.mms/com.android.mms.ui.ConversationList"
);
appMap
.
put
(
"通话记录"
,
"com.android.dialer/com.android.dialer.calllog.CallLogActivity"
);
// appMap.put("沃视达", "com.jisetv.iptv.activity/com.jisetv.iptv.splashscreen.activity.SplashScreenActivity");
}
else
{
appMap
.
put
(
"通话记录"
,
"com.sprd.simple.launcher/dx.com.contactforlaunch.ui.CallCenterActivity"
);
}
//mlistAppInfo = appInfos;
//mlistAppInfo = appInfos;
return
appMap
;
return
appMap
;
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment