小编Wil*_*iam的帖子

如何在android中加载动画svg?

我有一个SVG文件,其代码如下,动画.我想在Android原生应用程序中使用它.我该如何使用该svg文件?我知道使用svg滑行,我从下面的样本测试过.正常的svg正在工作但不是这个. https://github.com/bumptech/glide/tree/master/samples/svg

<?xml version="1.0" encoding="utf-8"?>
   <svg width='124px' height='124px' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-ring-alt">
     <rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect>
     <circle cx="50" cy="50" r="40" stroke="rgba(255,255,255,0.259)" fill="none" stroke-width="10" stroke-linecap="round"></circle><circle cx="50" cy="50" r="40" stroke="#ffffff" fill="none" stroke-width="6" stroke-linecap="round">
          <animate attributeName="stroke-dashoffset" dur="3s" repeatCount="indefinite" from="0" to="502"></animate>
          <animate attributeName="stroke-dasharray" dur="3s" repeatCount="indefinite" values="150.6 100.4;1 250;150.6 100.4"></animate>
     </circle>
</svg>
Run Code Online (Sandbox Code Playgroud)

请建议我任何库或代码示例谢谢.

java svg android svg-animate android-glide

6
推荐指数
0
解决办法
818
查看次数

如何解析 ktor 中发布的原始 json 数据列表

我正在发布对象的 json 数组。我正在尝试用这样的代码解析它

val objs = call.receive<List<MyClass>>() // this work fine
val name objs[0].name // this throw exception LinkedTreeMap cannot be cast to MyClass
Run Code Online (Sandbox Code Playgroud)

在上面的代码第二行抛出异常 com.google.gson.internal.LinkedTreeMap cannot be cast to MyClass

如果我发布简单的对象并在 ktor 中解析它, call.receive<MyClass>()那么它会正常工作。所以问题仅在解析对象列表时。

kotlin ktor

5
推荐指数
2
解决办法
2061
查看次数

quarkus 与 jooq 的结构

我在 php 上有应用程序后端。但最近我在 Quarkus 上创建了相同的后端,并将其部署在带有数据库 MYSQL 的 kubernetes 上。我在 php 后端路由一半用户,从应用路由一半 qaurkus。PHP 后端工作正常,但 quarkus 后端有问题,它在几个小时后卡住,请求延迟增加超过一分钟,有时会超时。在检查了一些堆栈之后,我发现它卡在数据源中的 getConnection 上,我正在起诉 agroal。它不是数据库问题,因为与此同时,如果我使用 php 检查应用程序,它运行良好,没有任何问题或延迟。我也尝试增加和减少最小/最大池大小,但仍然是同样的问题。我将分享我在 mysql 中使用 quarkus、agroal 和 jooq 的结构。我认为问题在于那个。

我正在使用 kotlin 并且 DSLContext 是静态的对象。

应用程序.kt

@ApplicationScoped
class AppLifecycleBean {
    @Inject
    lateinit var dsl: DSLContext
    @Inject
    lateinit var launchMode: LaunchMode

    fun onStart(@Observes ev: StartupEvent?) {
        DBHelper.init(dsl)
    }

    fun onStop(@Observes ev: ShutdownEvent?) {
    }

}
Run Code Online (Sandbox Code Playgroud)

数据库助手.kt

object DBHelper {
    lateinit var db: DSLContext
    private set

    fun init(db: DSLContext){
        this.db = db
    }
}
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,我在应用程序开始时将 JOOQ …

jooq quarkus agroal

5
推荐指数
1
解决办法
263
查看次数

如何使用FirebaseAuth从Google提供商处获得性别和生日?

我正在尝试使用Firebase AuthUI从Google提供商处获得性别和生日.这是我的代码.

AuthUI.IdpConfig googleIdp = new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER)
                .setPermissions(Arrays.asList(Scopes.EMAIL, Scopes.PROFILE, Scopes.PLUS_ME))
                .build();

startActivityForResult(
                AuthUI.getInstance().createSignInIntentBuilder()
                        .setLogo(R.drawable.firebase_auth_120dp)
                        .setProviders(Arrays.asList(
                new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build(),
                googleIdp))
                        .setIsSmartLockEnabled(false)
                        .setTheme(R.style.AppTheme_Login)
                        .build(),
                RC_SIGN_IN);
Run Code Online (Sandbox Code Playgroud)

在onActivityResult中:

IdpResponse idpResponse = IdpResponse.fromResultIntent(data);
Run Code Online (Sandbox Code Playgroud)

我有idpResponse,但它只包括idpSecretidpToken.如何访问性别和生日等个人资料的其他请求字段?我可以访问公共领域的电子邮件,姓名,照片等

FirebaseAuth.getInstance().getCurrentUser();
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-authentication google-signin

3
推荐指数
1
解决办法
4655
查看次数