此代码示例中的“提供”语法是什么?它有什么作用?
LocalContentAlpha provides ContentAlpha.medium
Run Code Online (Sandbox Code Playgroud)
它似乎不是一个标准的 kotlin 关键字,而且我在谷歌上搜索“kotlin提供关键字”或“jetpack compose提供”等查询也没有太多运气。
这显示在Jetpack Compose codelab上,完整片段如下。
@Composable
fun PhotographerCard() {
Column {
Text("Alfred Sisley", fontWeight = FontWeight.Bold)
// LocalContentAlpha is defining opacity level of its children
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text("3 minutes ago", style = MaterialTheme.typography.body2)
}
}
}
@Preview
@Composable
fun PhotographerCardPreview() {
LayoutsCodelabTheme {
PhotographerCard()
}
}
Run Code Online (Sandbox Code Playgroud) 从https://firebase.google.com/docs/auth/web/phone-auth:
如果 signInWithPhoneNumber 导致错误,请重置 reCAPTCHA,以便用户可以重试:
Run Code Online (Sandbox Code Playgroud)grecaptcha.reset(window.recaptchaWidgetId); // Or, if you haven't stored the widget ID: window.recaptchaVerifier.render().then(function(widgetId) { grecaptcha.reset(widgetId); }
但从grecaptcha
未定义。我必须从某个地方导入它吗?
我正在使用https://github.com/firebase/FirebaseUI-Android/tree/master/database中描述的FirebaseIndexRecyclerAdapter .但我的列表有很多项目,我想首先只加载一些项目,然后在用户向上滚动时懒惰加载其余项目.
我的第一个想法是我可以使用mKeyRef.limitToLast(5)
但是然后更新这需要重新创建适配器,对吗?
我如何实现这种延迟加载机制?
RecyclerView recycler = (RecyclerView) findViewById(R.id.messages_recycler);
recycler.setHasFixedSize(true);
recycler.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new FirebaseIndexRecyclerAdapter<Chat, ChatHolder>(
Chat.class,
android.R.layout.two_line_list_item,
ChatHolder.class, mIndexRef,
mDataRef) {
@Override
public void populateViewHolder(ChatHolder chatMessageViewHolder, Chat chatMessage, int position) {
chatMessageViewHolder.setName(chatMessage.getName());
chatMessageViewHolder.setText(chatMessage.getText());
}
};
recycler.setAdapter(mAdapter);
Run Code Online (Sandbox Code Playgroud) 我有一个Webapp,其中使用Firebase Auth对用户进行匿名身份验证。我将来自用户的图像存储在Firebase Storage中,该存储在幕后由Google Cloud Storage存储桶支持。当我尝试从客户端javascript使用Google Cloud Vision API获取图像属性时,出现权限错误。
image-annotator::User lacks permission.: Can not open file: gs://MYAPP.appspot.com/photos/IMG_12345.jpg
Run Code Online (Sandbox Code Playgroud)
如果我将图像公开,则一切正常。但这是用户数据,不能公开。我该如何解决?
我调用视觉API的代码:
gapi.client.init({
'apiKey': MY_API_KEY,
'discoveryDocs': ['https://vision.googleapis.com/$discovery/rest'],
// clientId and scope are optional if auth is not required.
'clientId': MY_APP_ID + '.apps.googleusercontent.com',
'scope': 'profile',
}).then(function() {
// 3. Initialize and make the API request.
return gapi.client.vision.images.annotate({
"requests":
[
{
"features":
[
{
"type": "LABEL_DETECTION"
},
{
"type": "IMAGE_PROPERTIES"
}
],
"image":
{
"source":
{
"gcsImageUri": "gs://MY_APP.appspot.com/photos/" + "IMG_12345.jpg"
}
}
}
]
});
}).then(function(response) …
Run Code Online (Sandbox Code Playgroud) javascript firebase firebase-authentication google-cloud-vision firebase-storage
来自http://docs.opencv.org/2.4/modules/core/doc/drawing_functions.html#puttext:
\n\n\n\n\nfontScale \xe2\x80\x93 乘以特定于字体的基本尺寸的字体比例因子。
\n
好时字体的基本尺寸是多少?我到处都找不到它。
\n注意:符号显示在我们的 c++ 库的 crashlytics 中,问题是它们没有显示在
libc
、libart
、libbase
和 等系统库中libandroid_runtime
。
我们有一些完全发生在 Android 运行时中的棘手崩溃,如果没有符号,这些崩溃很难调试。在 firebase crashlytics 中,我们看到以下堆栈跟踪:
Crashed: Thread : SIGABRT 0x0000000000000000
#00 pc 0x4e574 libc.so
#01 pc 0x4e540 libc.so
#02 pc 0x5677d8 libart.so
#03 pc 0x13ab0 libbase.so
#04 pc 0x13090 libbase.so
#05 pc 0x38cb6c libart.so
#06 pc 0x39f7d8 libart.so
#07 pc 0x1260e0 libandroid_runtime.so
#08 pc 0x124ef4 libandroid_runtime.so
#09 pc 0x124dc4 libandroid_runtime.so
#10 pc 0x115468 libandroid_runtime.so
Run Code Online (Sandbox Code Playgroud)
当我通过取消引用空指针来强制 C++ 库中的测试崩溃时,我在本地 Android Studio 控制台中看到以下回溯:
...snip...
#06 pc …
Run Code Online (Sandbox Code Playgroud) 我按照以下说明安装了gcloud:https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu
gcloud
在我的路上/usr/bin/gcloud
,但包裹似乎没有dev_appserver.py
在我的道路上.它安装了吗?我该怎么运行它?
平台:Ubuntu 16.04
编辑:通过运行dpkg -L google-cloud-sdk
我发现它,/usr/lib/google-cloud-sdk/bin/dev_appserver.py
但当我尝试运行它时,我得到:
This action requires the installation of components: [app-engine-
python]
You cannot perform this action because this Cloud SDK installation is
managed by an external package manager. If you would like to get the
也不确定为什么它没有添加到我的路径.
调用尝试创建任务的 firebase HTTP 函数时,我在 firebase 控制台函数日志中收到错误。
错误:7 PERMISSION_DENIED:主体(用户或服务帐户)缺少资源“projects/my-gcloud-project-id/locations/us-central1/queues/myqueuename”(或资源可能不存在)。
也许我对 gcloud id 和位置与 firebase id 和位置之间感到困惑?
编辑:我已通过运行确认我的位置是 us-central1gcloud --project my-gcloud-project-id tasks locations list
或者也许我需要设置权限?
我的代码:
const functions = require('firebase-functions');
const { CloudTasksClient } = require('@google-cloud/tasks')
const projectId = 'my-firebase-project-id';
const location = 'us-central1'
const queue = 'myqueuename'
exports.onFormSubmit = functions.https.onRequest(async (req, res) => {
const tasksClient = new CloudTasksClient()
const queuePath = tasksClient.queuePath('my-gcloud-project-id', location, queue);
const url = `https://google.com/` // edited for stack overflow
const delaySeconds = 5;
console.log('delaying for …
Run Code Online (Sandbox Code Playgroud) firebase ×4
android ×3
javascript ×2
android-ndk ×1
bionic ×1
c++ ×1
crashlytics ×1
firebaseui ×1
fonts ×1
gcloud ×1
kotlin ×1
node.js ×1
opencv ×1
python ×1
recaptcha ×1