Commit 45a84f71 by cuiliang.shi

v1.0

1 parent 8210ae26
......@@ -15,8 +15,8 @@ android {
applicationId "com.toscl.turingos"
minSdkVersion 15
targetSdkVersion 22
versionCode 9
versionName "0.9"
versionCode 10
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
......
......@@ -41,11 +41,11 @@
android:theme="@style/AppTheme.Launcher"
android:name="com.toscl.turingos.MainActivity"
android:screenOrientation="portrait">
<!-- <intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>-->
</intent-filter>
</activity>
<meta-data
......
......@@ -138,6 +138,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
"按下OK键给我指令,你可以和我说:\"来首好听的歌。\"",
"按下OK键给我指令,你可以和我说:\"101乘以125等于多少。\"",
"按下OK键给我指令,你可以和我说:\"定一个早上8点的闹钟。\"",
"如果正在游戏中需要给我指令,你可以先和我说:\"退出。\"",
};
int index = (int) (Math.random()*(helpInfo.length-1));
......@@ -146,9 +147,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
.setContentText(helpInfo[index]);
mGlobalDialog.show();
mGlobalDialog.findViewById(R.id.confirm_button).setOnClickListener(new View.OnClickListener() {
mGlobalDialog.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(View view) {
public void onClick(SweetAlertDialog sDialog) {
operateAll();
}
});
......@@ -193,12 +194,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
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);
appAndContactsBean.setAppsMap(appMap);
}
// }
Map<String, String> contactMap = SkillsSlotUtil.getContacts(mContext);
appAndContactsBean.setContactMap(contactMap);
......@@ -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());
switch (intent.getCode()) {
case 200101:
......@@ -668,8 +669,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
}
break;
default:
break;
return 0;
}
return 1;
}
private Handler mLoadToastHandler = new Handler(){
......@@ -766,18 +768,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
Log.d(TAG, "ttsSequenceList onSpeakBegin s.length:" + s.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
......@@ -792,13 +782,29 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
@Override
public void onSpeakCompleted() {
mUiHandler.sendEmptyMessage(0);
handleTtsResultCode(intent, MainActivity.this);
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)) {
musicHandler.sendEmptyMessage(MusicHandler.MSG_TTS_FINISH);
return;
}
}*/
}
@Override
......@@ -1092,7 +1098,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
private TuringOsService osService;
private long mClickTime = 0;
public void operateAll() {
if ((System.currentTimeMillis() - mClickTime) < 500){
return;
}
mClickTime = System.currentTimeMillis();
Log.d(TAG, "operateAll");
mLoadToast.setText("正在倾听中...");
......@@ -1303,19 +1314,25 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
return;
}
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
public void run() {
startMusic(finalMediaUrl);
/* Bundle bundle = new Bundle();
*//* Bundle bundle = new Bundle();
bundle.putString("url", finalMediaUrl);
Message message = new Message();
message.setData(bundle);
message.what = MusicHandler.MSG_PREPARE_TURING;
musicHandler.sendMessage(message);
setMusicView(true);*/
setMusicView(true);*//*
}
});
});*/
} catch (JSONException e) {
Log.e(TAG, " parse exception");
e.printStackTrace();
......
......@@ -129,7 +129,6 @@ public class SkillsSlotUtil {
appMap.put("音乐播放器", "com.android.music/com.android.music.MusicBrowserActivity");
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/dx.com.contactforlaunch.ui.CallCenterActivity");
appMap.put("相机", "com.mediatek.camera/com.mediatek.camera.CameraLauncher");
appMap.put("最美天气", "com.icoolme.android.weather");
......@@ -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");
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;
return appMap;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!