Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Takeya-Yuki
RubyLib
提交
019927e6
R
RubyLib
项目概览
Takeya-Yuki
/
RubyLib
8 个月 前同步成功
通知
39
Star
19
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
RubyLib
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
019927e6
编写于
8月 11, 2017
作者:
T
Takeya Yuki
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add TTS Functions
上级
3cb995aa
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
159 addition
and
28 deletion
+159
-28
README.md
README.md
+2
-1
app/src/main/java/jp/ruby/rubylibrary/A.java
app/src/main/java/jp/ruby/rubylibrary/A.java
+0
-10
app/src/main/java/jp/ruby/rubylibrary/JS.java
app/src/main/java/jp/ruby/rubylibrary/JS.java
+40
-0
app/src/main/java/jp/ruby/rubylibrary/MainActivity.java
app/src/main/java/jp/ruby/rubylibrary/MainActivity.java
+8
-10
app/src/main/res/layout/activity_main.xml
app/src/main/res/layout/activity_main.xml
+3
-4
rubylib/build.gradle
rubylib/build.gradle
+3
-3
rubylib/src/main/java/yuki/tts/extended/TTSComplexController.java
...src/main/java/yuki/tts/extended/TTSComplexController.java
+63
-0
rubylib/src/main/java/yuki/tts/extended/TTSSimpleController.java
.../src/main/java/yuki/tts/extended/TTSSimpleController.java
+40
-0
未找到文件。
README.md
浏览文件 @
019927e6
...
...
@@ -7,6 +7,7 @@ Network Detect<br/>
Storage IO
<br/>
Command Line Support
<br/>
UI Control Features (Status Bar and Navigation Bar)
<br/>
TTS Features
<br/>
## Current Version
1.
0-git-20170
6291123
1.
0-git-20170
8111646
app/src/main/java/jp/ruby/rubylibrary/A.java
已删除
100644 → 0
浏览文件 @
3cb995aa
package
jp.ruby.rubylibrary
;
/**
* Created by Akeno on 2017/06/30.
*/
public
class
A
{
public
int
a
;
public
String
b
;
}
app/src/main/java/jp/ruby/rubylibrary/JS.java
0 → 100644
浏览文件 @
019927e6
package
jp.ruby.rubylibrary
;
import
android.content.Context
;
import
android.speech.tts.TextToSpeech
;
import
android.webkit.JavascriptInterface
;
import
android.widget.Toast
;
import
java.util.Locale
;
/**
* Created by Akeno on 2017/08/11.
*/
public
class
JS
{
private
Context
context
;
private
TextToSpeech
tts
;
public
JS
(
final
Context
context
)
{
// TODO Auto-generated constructor stub
this
.
context
=
context
;
tts
=
new
TextToSpeech
(
context
,
new
TextToSpeech
.
OnInitListener
()
{
@Override
public
void
onInit
(
int
status
)
{
// TODO Auto-generated method stub
if
(
status
==
TextToSpeech
.
SUCCESS
)
{
int
result
=
tts
.
setLanguage
(
Locale
.
SIMPLIFIED_CHINESE
);
if
(
result
==
TextToSpeech
.
LANG_MISSING_DATA
||
result
==
TextToSpeech
.
LANG_NOT_SUPPORTED
)
{
Toast
.
makeText
(
context
,
"Language is not available."
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}
});
}
@JavascriptInterface
public
void
say
(
String
text
)
{
tts
.
speak
(
text
,
TextToSpeech
.
QUEUE_FLUSH
,
null
);
}
}
app/src/main/java/jp/ruby/rubylibrary/MainActivity.java
浏览文件 @
019927e6
...
...
@@ -16,11 +16,13 @@ import android.widget.LinearLayout;
import
android.widget.TextView
;
import
java.nio.charset.Charset
;
import
java.util.Locale
;
import
yuki.control.extended.WebViewEx
;
import
yuki.resource.extended.GsonConvert
;
import
yuki.resource.extended.StorageIOManager
;
import
yuki.resource.extended.UIController
;
import
yuki.tts.extended.TTSComplexController
;
public
class
MainActivity
extends
Activity
{
...
...
@@ -28,16 +30,12 @@ public class MainActivity extends Activity {
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
A
a
=
new
A
();
a
.
a
=
1
;
a
.
b
=
"hello world!"
;
TextView
tv
=
findViewById
(
R
.
id
.
tv
);
String
gson
=
GsonConvert
.
SerializeObject
(
a
);
tv
.
setText
(
gson
);
A
b
=
GsonConvert
.
DeserializeObject
(
gson
,
A
.
class
);
b
=
null
;
Intent
aa
=
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
"weixin://baidu.com/"
));
startActivity
(
aa
);
WebView
wv
=
(
WebView
)
findViewById
(
R
.
id
.
wv
);
wv
.
getSettings
().
setJavaScriptCanOpenWindowsAutomatically
(
true
);
wv
.
getSettings
().
setJavaScriptEnabled
(
true
);
wv
.
loadUrl
(
"http://10.1.1.134:8282/Client.html"
);
wv
.
addJavascriptInterface
(
new
TTSComplexController
(
getApplicationContext
(),
Locale
.
SIMPLIFIED_CHINESE
),
"tts"
);
//wv.addJavascriptInterface(new JS(getApplicationContext()), "tts");
}
}
...
...
app/src/main/res/layout/activity_main.xml
浏览文件 @
019927e6
...
...
@@ -7,9 +7,8 @@
android:orientation=
"vertical"
tools:context=
"jp.ruby.rubylibrary.MainActivity"
>
<
Text
View
android:id=
"@+id/
t
v"
<
Web
View
android:id=
"@+id/
w
v"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"TextView"
/>
android:layout_height=
"match_parent"
/>
</LinearLayout>
rubylib/build.gradle
浏览文件 @
019927e6
...
...
@@ -7,7 +7,7 @@ publish {
userOrg
=
'takeya-yuki-studio'
//bintray注册的用户名
groupId
=
'jp.ruby.rubylib'
//compile引用时的第1部分groupId
artifactId
=
'rubylib'
//compile引用时的第2部分项目名
publishVersion
=
'1.0.
4
'
//compile引用时的第3部分版本号
publishVersion
=
'1.0.
5
'
//compile引用时的第3部分版本号
desc
=
'Ruby Extended Controls'
website
=
'https://github.com/Takeya-Yuki/RubyLib.git'
}
...
...
@@ -20,8 +20,8 @@ android {
defaultConfig
{
minSdkVersion
17
targetSdkVersion
26
versionCode
4
versionName
"1.0.
4
"
versionCode
5
versionName
"1.0.
5
"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
...
...
rubylib/src/main/java/yuki/tts/extended/TTSComplexController.java
0 → 100644
浏览文件 @
019927e6
package
yuki.tts.extended
;
import
android.content.Context
;
import
android.speech.tts.TextToSpeech
;
import
android.speech.tts.UtteranceProgressListener
;
import
android.util.Log
;
import
android.webkit.JavascriptInterface
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Locale
;
/**
* Created by Akeno on 2017/08/11.
*/
public
class
TTSComplexController
{
private
Context
context
;
private
TextToSpeech
tts
;
private
ArrayList
<
String
>
textList
;
public
TTSComplexController
(
final
Context
context
,
final
Locale
locale
){
// TODO Auto-generated constructor stub
this
.
context
=
context
;
textList
=
new
ArrayList
<
String
>();
tts
=
new
TextToSpeech
(
context
,
new
TextToSpeech
.
OnInitListener
()
{
@Override
public
void
onInit
(
int
status
)
{
// TODO Auto-generated method stub
if
(
status
==
TextToSpeech
.
SUCCESS
)
{
int
result
=
tts
.
setLanguage
(
locale
);
if
(
result
==
TextToSpeech
.
LANG_MISSING_DATA
||
result
==
TextToSpeech
.
LANG_NOT_SUPPORTED
)
{
Log
.
d
(
"TTS"
,
"Language '"
+
locale
.
getDisplayLanguage
()+
"'is not supported"
);
}
}
}
});
tts
.
setOnUtteranceProgressListener
(
new
UtteranceProgressListener
()
{
@Override
public
void
onStart
(
String
s
)
{
}
@Override
public
void
onDone
(
String
s
)
{
if
(
textList
.
size
()>
0
)
{
textList
.
remove
(
0
);
}
}
@Override
public
void
onError
(
String
s
)
{
}
});
}
@JavascriptInterface
public
void
say
(
String
text
)
{
textList
.
add
(
text
);
tts
.
speak
(
text
,
TextToSpeech
.
QUEUE_ADD
,
null
);
}
}
rubylib/src/main/java/yuki/tts/extended/TTSSimpleController.java
0 → 100644
浏览文件 @
019927e6
package
yuki.tts.extended
;
import
android.content.Context
;
import
android.speech.tts.TextToSpeech
;
import
android.util.Log
;
import
android.webkit.JavascriptInterface
;
import
android.widget.Toast
;
import
java.util.Locale
;
/**
* Created by Akeno on 2017/08/11.
*/
public
class
TTSSimpleController
{
private
Context
context
;
private
TextToSpeech
tts
;
public
TTSSimpleController
(
final
Context
context
,
final
Locale
locale
){
// TODO Auto-generated constructor stub
this
.
context
=
context
;
tts
=
new
TextToSpeech
(
context
,
new
TextToSpeech
.
OnInitListener
()
{
@Override
public
void
onInit
(
int
status
)
{
// TODO Auto-generated method stub
if
(
status
==
TextToSpeech
.
SUCCESS
)
{
int
result
=
tts
.
setLanguage
(
locale
);
if
(
result
==
TextToSpeech
.
LANG_MISSING_DATA
||
result
==
TextToSpeech
.
LANG_NOT_SUPPORTED
)
{
Log
.
d
(
"TTS"
,
"Language '"
+
locale
.
getDisplayLanguage
()+
"'is not supported"
);
}
}
}
});
}
@JavascriptInterface
public
void
say
(
String
text
)
{
tts
.
speak
(
text
,
TextToSpeech
.
QUEUE_FLUSH
,
null
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录