You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2018/01/17 12:47:09 UTC
[4/9] incubator-weex git commit: * [android] sync return for locale
module
* [android] sync return for locale module
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/b36452ef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/b36452ef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/b36452ef
Branch: refs/heads/master
Commit: b36452eff935dde161b1a231180dbbd3e9eb6fc7
Parents: bbd0829
Author: misakuo <mi...@apache.org>
Authored: Mon Jan 15 15:50:52 2018 +0800
Committer: misakuo <mi...@apache.org>
Committed: Mon Jan 15 15:50:52 2018 +0800
----------------------------------------------------------------------
.../taobao/weex/ui/module/WXLocaleModule.java | 24 +++++++++++++-------
1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b36452ef/android/sdk/src/main/java/com/taobao/weex/ui/module/WXLocaleModule.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/module/WXLocaleModule.java b/android/sdk/src/main/java/com/taobao/weex/ui/module/WXLocaleModule.java
index 5b243b4..67644b5 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/module/WXLocaleModule.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/module/WXLocaleModule.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -36,25 +36,33 @@ import java.util.Locale;
/**
* Created by moxun on 2017/9/26.
- *
+ * <p>
* Ref: https://tools.ietf.org/html/bcp47
*/
public class WXLocaleModule extends WXModule {
@JSMethod(uiThread = false)
- public String getLanguage(JSCallback callback) {
- String languageTags = getLanguageTags();
+ public String getLanguage() {
+ return getLanguageTags();
+ }
+
+ @JSMethod(uiThread = false)
+ public void getLanguage(JSCallback callback) {
callback.invoke(getLanguageTags());
- return languageTags;
}
@JSMethod(uiThread = false)
- public List<String> getLanguages(JSCallback callback) {
+ public List<String> getLanguages() {
String[] tags = getLanguageTags().split(",");
return Arrays.asList(tags);
}
+ @JSMethod(uiThread = false)
+ public void getLanguages(JSCallback callback) {
+ callback.invoke(getLanguageTags().split(","));
+ }
+
private String getLanguageTags() {
Context application = WXEnvironment.getApplication();
if (application != null) {