Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
2c5a1bf5
E
engine
项目概览
liujiuri
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2c5a1bf5
编写于
3月 16, 2018
作者:
S
Sarah Zakarias
提交者:
GitHub
3月 16, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Provide lookup key to access Flutter assets in the APK (#4785)
上级
9671f634
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
69 addition
and
1 deletion
+69
-1
shell/platform/android/io/flutter/app/FlutterPluginRegistry.java
...latform/android/io/flutter/app/FlutterPluginRegistry.java
+11
-0
shell/platform/android/io/flutter/plugin/common/PluginRegistry.java
...form/android/io/flutter/plugin/common/PluginRegistry.java
+23
-0
shell/platform/android/io/flutter/view/FlutterMain.java
shell/platform/android/io/flutter/view/FlutterMain.java
+27
-1
shell/platform/android/io/flutter/view/FlutterView.java
shell/platform/android/io/flutter/view/FlutterView.java
+8
-0
未找到文件。
shell/platform/android/io/flutter/app/FlutterPluginRegistry.java
浏览文件 @
2c5a1bf5
...
...
@@ -9,6 +9,7 @@ import android.content.Context;
import
android.content.Intent
;
import
android.util.Log
;
import
io.flutter.plugin.common.*
;
import
io.flutter.view.FlutterMain
;
import
io.flutter.view.FlutterNativeView
;
import
io.flutter.view.FlutterView
;
import
io.flutter.view.TextureRegistry
;
...
...
@@ -111,6 +112,16 @@ public class FlutterPluginRegistry
return
mFlutterView
;
}
@Override
public
String
lookupKeyForAsset
(
String
asset
)
{
return
FlutterMain
.
getLookupKeyForAsset
(
asset
);
}
@Override
public
String
lookupKeyForAsset
(
String
asset
,
String
packageName
)
{
return
FlutterMain
.
getLookupKeyForAsset
(
asset
,
packageName
);
}
@Override
public
Registrar
publish
(
Object
value
)
{
mPluginMap
.
put
(
pluginKey
,
value
);
...
...
shell/platform/android/io/flutter/plugin/common/PluginRegistry.java
浏览文件 @
2c5a1bf5
...
...
@@ -105,6 +105,29 @@ public interface PluginRegistry {
*/
FlutterView
view
();
/**
* Returns the file name for the given asset.
* The returned file name can be used to access the asset in the APK
* through the {@link AssetManager} API.
*
* @param asset the name of the asset. The name can be hierarchical
* @return the filename to be used with {@link AssetManager}
*/
String
lookupKeyForAsset
(
String
asset
);
/**
* Returns the file name for the given asset which originates from the
* specified packageName. The returned file name can be used to access
* the asset in the APK through the {@link AssetManager} API.
*
* @param asset the name of the asset. The name can be hierarchical
* @param packageName the name of the package from which the asset originates
* @return the file name to be used with {@link AssetManager}
*/
String
lookupKeyForAsset
(
String
asset
,
String
packageName
);
/**
* Publishes a value associated with the plugin being registered.
*
...
...
shell/platform/android/io/flutter/view/FlutterMain.java
浏览文件 @
2c5a1bf5
...
...
@@ -73,7 +73,7 @@ public class FlutterMain {
private
static
final
String
MANIFEST
=
"flutter.yaml"
;
private
static
String
fromFlutterAssets
(
String
filePath
)
{
return
sFlutterAssetsDir
+
"/"
+
filePath
;
return
sFlutterAssetsDir
+
File
.
separator
+
filePath
;
}
private
static
final
Set
<
String
>
SKY_RESOURCES
=
ImmutableSetBuilder
.<
String
>
newInstance
()
...
...
@@ -308,4 +308,30 @@ public class FlutterMain {
File
appBundle
=
new
File
(
dataDirectory
,
sFlutterAssetsDir
);
return
appBundle
.
exists
()
?
appBundle
.
getPath
()
:
null
;
}
/**
* Returns the file name for the given asset.
* The returned file name can be used to access the asset in the APK
* through the {@link AssetManager} API.
*
* @param asset the name of the asset. The name can be hierarchical
* @return the filename to be used with {@link AssetManager}
*/
public
static
String
getLookupKeyForAsset
(
String
asset
)
{
return
fromFlutterAssets
(
asset
);
}
/**
* Returns the file name for the given asset which originates from the
* specified packageName. The returned file name can be used to access
* the asset in the APK through the {@link AssetManager} API.
*
* @param asset the name of the asset. The name can be hierarchical
* @param packageName the name of the package from which the asset originates
* @return the file name to be used with {@link AssetManager}
*/
public
static
String
getLookupKeyForAsset
(
String
asset
,
String
packageName
)
{
return
getLookupKeyForAsset
(
"packages"
+
File
.
separator
+
packageName
+
File
.
separator
+
asset
);
}
}
shell/platform/android/io/flutter/view/FlutterView.java
浏览文件 @
2c5a1bf5
...
...
@@ -254,6 +254,14 @@ public class FlutterView extends SurfaceView
return
mNativeView
.
getPluginRegistry
();
}
public
String
getLookupKeyForAsset
(
String
asset
)
{
return
FlutterMain
.
getLookupKeyForAsset
(
asset
);
}
public
String
getLookupKeyForAsset
(
String
asset
,
String
packageName
)
{
return
FlutterMain
.
getLookupKeyForAsset
(
asset
,
packageName
);
}
public
void
addActivityLifecycleListener
(
ActivityLifecycleListener
listener
)
{
mActivityLifecycleListeners
.
add
(
listener
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录