小编Edr*_*ric的帖子

向 GitHub Actions macOS 自托管运行器提供密码

我已经使用 GitHub Actions 自托管运行器说明设置了 CI 构建服务器。一切正常,直到达到以下指令:

sudo xcode-select -switch /Applications/Xcode_11.5.app
Run Code Online (Sandbox Code Playgroud)

它要求我在 macOS 终端内输入密码。如果我每次运行该作业时都必须输入密码,那么这就违背了构建服务器的目的。我尝试将运行程序配置为服务,但是当我这样做时,作业完全失败,因为它需要终端来询问密码。

有没有办法设置密码,让跑步者不再每次都询问我?

macos sudo github-actions

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

如何设置Android MaterialCalendars各种组件的样式

我正在尝试设计这个样式MaterialCalendar,但我没有取得任何进展,任何帮助将不胜感激。我的styles.xml看起来类似于以下内容:

 <style name="AppTheme" parent="Theme.MaterialComponents">
    <item name="materialCalendarTheme">@style/ThemeMaterialCalendar</item>
</style>

<style name="ThemeMaterialCalendar" parent="ThemeOverlay.MaterialComponents.MaterialCalendar">
    <item name="buttonBarPositiveButtonStyle">@style/AlterDialogButtonStyle</item>
    <item name="buttonBarNegativeButtonStyle">@style/AlterDialogButtonStyle</item>
    <item name="materialButtonStyle">@style/ThemeMaterialCalendarTextButton</item>
    <item name="android:colorAccent">@color/accent</item>
</style>

<style name="ThemeMaterialCalendarTextButton" parent="Widget.MaterialComponents.Button.TextButton.Dialog.Flush">
    <item name="android:textColor">?attr/colorAccent</item>
</style>

<style name="AlterDialogButtonStyle" parent="Widget.MaterialComponents.Button.TextButton">
    <item name="android:textColor">?attr/colorAccent</item>
</style>
Run Code Online (Sandbox Code Playgroud)

其呈现如下:

在此输入图像描述

非常浅的蓝色/青色是我的colorAccent标题是紫色的颜色。这些都很好。我能够用上面的内容来改变它们styles.xml

不过,我还想将 的深灰色背景更改MaterialCalendar为白色,然后当然将文本从白色更改为黑色或灰色(这样就可以看到),并制作用于选择月份和年份的箭头。任何选定的年份或日期都应使用强调色突出显示。

DatePickerDialog本质上我想要与此类似的东西(请忽略下面的屏幕截图是旧的而不是新的事实MaterialCalendar):

在此输入图像描述

任何帮助将不胜感激。

PS:我不想更改整个应用程序的任何主要颜色、次要颜色或强调色(因为这会破坏其余的配色方案)

android android-datepicker android-styles material-components-android

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

通过按按钮显示 Android 应用程序内审核对话框?

新的应用程序内评论对话框的指南中,谷歌表示

\n
\n

您的应用程序不应在呈现评分按钮或卡片之前或同时询问用户任何问题,包括有关他们意见的问题(例如 \xe2\x80\x9c 你喜欢该应用程序吗?\xe2\x80\x9d)或预测性问题(例如如 \xe2\x80\x9c 您能否将此应用评为 5 星\xe2\x80\x9d)。

\n
\n

由于它说应该,而不是必须,所以不清楚在显示对话框之前询问用户是否愿意留下评论是否确实违反了某些策略。这样做的原因有很多,例如,为了最大限度地减少对用户工作流程的干扰,并让他们在方便时留下评论。

\n

然而,在这些指南中也提到

\n
\n

调用 launchReviewFlow 方法可能并不总是显示对话框。

\n
\n

我还没有时间实现应用程序审核对话框,但我猜如果对话框不显示,人们可以简单地将用户重定向到 Play 商店?

\n

我想知道的是 - Google 的此类指南有多严格?它们更像是友好的建议而不是 Play 商店政策吗?如果一个人做了不建议(“应该”)的事情,会发生什么?

\n

android google-play

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

使用新的 androidx.BiometricPrompt 通过生物识别注册使密钥无效

我正在使用新androidx.BiometricPromt库通过指纹实现身份验证。如果用户添加新指纹或删除指纹,我想使密钥无效。我正在创建这样的密钥:

fun getSecretKey(shouldCreate: Boolean): Key {
    val keyStore = KeyStore.getInstance(ANDROID_KEYSTORE)
    keyStore.load(null)
    return if (shouldCreate) {
        createSecretKey(keyStore)
    } else {
        keyStore.getKey(ALIAS_BIOMETRICS, null)
    }
}

private fun createSecretKey(keystore: KeyStore): Key {
    val builder = KeyGenParameterSpec.Builder(
        ALIAS_BIOMETRICS,
        KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT
    )
        .setBlockModes(KeyProperties.BLOCK_MODE_CBC)
        .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7)
        .setUserAuthenticationRequired(true)
        .setUserAuthenticationValidityDurationSeconds(5)

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        builder.setInvalidatedByBiometricEnrollment(true)
        builder.setUserAuthenticationValidWhileOnBody(true)
    }

    val keyGenerator =
        KeyGenerator.getInstance(keyAlgorithm, keystore.provider)
    keyGenerator
        .init(builder.build())
    return keyGenerator.generateKey()
}
Run Code Online (Sandbox Code Playgroud)

我正在开始这样的生物识别扫描过程:

val info = BiometricPrompt.PromptInfo.Builder()
    .setTitle(context.getString(R.string.biometric_dialog_title))
    .setSubtitle(context.getString(R.string.biometric_dialog_subtitle))
    .setNegativeButtonText(context.getString(R.string.biometric_dialog_cancel))
    .build()

biometricPrompt = when (screen) {
    is FragmentActivity -> BiometricPrompt(screen, …
Run Code Online (Sandbox Code Playgroud)

android android-keystore android-biometric-prompt

5
推荐指数
0
解决办法
250
查看次数

Angular 2 Material 主题参考 SCSS 中的颜色

我用官方指南创建了一个自定义主题。

@import '../node_modules/@angular/material/core/theming/_all-theme';
@include mat-core();

$primary: mat-palette($mat-teal);
$accent: mat-palette($mat-deep-orange);
$warn: mat-palette($mat-amber);

$theme: mat-light-theme($primary, $accent, $warn);

@include angular-material-theme($theme);
Run Code Online (Sandbox Code Playgroud)

它确实有效。md-toolbar我可以设置 a或md-buttonwith的颜色$primary。但我无法访问组件 SCSS 中的颜色变量。

:host {
  .mat-grid-tile-header {
    background-color: $primary;
  }
}
Run Code Online (Sandbox Code Playgroud)

网络风暴中的错误:

"Element 'primary' is resolved only by name without using of explicit imports"
Run Code Online (Sandbox Code Playgroud)

构建失败后出现错误:“未定义的变量”

好吧,我必须以某种方式导入它。但我不明白怎么办。

我尝试过导入主题:

"Element 'primary' is resolved only by name without using of explicit imports"
Run Code Online (Sandbox Code Playgroud)

Webstorm中的错误已经消失,但是构建后出现了新的错误:

Module build failed: 
undefined
            ^
      (50: #e0f2f1, 100: #b2dfdb, 200: #80cbc4, 300: #4db6ac, 400: …
Run Code Online (Sandbox Code Playgroud)

sass angular-material2 angular

4
推荐指数
1
解决办法
7311
查看次数

如何接口 Output() 和 Input() 装饰器?

我想为生成 JSON 的组件创建一个接口。我想强制每个实现组件接受一个类型作为输入并产生一个输出:

import { EventEmitter, Output, Input } from '@angular/core';
import { Foo, FooConfiguration } from '../../interfaces';
interface FooConfigurator {
    @Output() fooWasConfigured: EventEmitter<FooConfiguration>;
    @Input() fooInstance: Foo;
}
Run Code Online (Sandbox Code Playgroud)

然后,实现 FooConfigurator 的组件将确保以下内容:

import { EventEmitter, Output, Input } from '@angular/core';
import { Foo, FooConfiguration, FooConfigurator } from '../../interfaces';
class ConcreteFooConfigurator implements FooConfigurator {
    @Output() fooWasConfigured: EventEmitter<FooConfiguration>;
    @Input() fooInstance: Foo; 
}
Run Code Online (Sandbox Code Playgroud)

此接口定义失败,因为它的语法无效。我该怎么做,或者更好地解决问题?

interface decorator typescript angular

4
推荐指数
1
解决办法
2554
查看次数

如何在 MkDocs 材质主题中添加自定义内联样式

我一直在寻找一种将自定义样式添加到我的 Markdown 页面的方法。我已经能够将“extra_css”添加到 yml 文件中,但这似乎只影响生成的 html。例如,我能够为图像添加自定义样式,使所有项目居中。

我知道有一种方法可以使用以下方式添加属性

{: #someid .someclass somekey='some value' }
Run Code Online (Sandbox Code Playgroud)

所以这是一个由两部分组成的问题:

  1. 我在哪里创建样式?在我的 yml 中声明的自定义 css 文件中?

示例:extra_css:
-custom.css

  1. 如何在我的降价中内联引用(应用)它们?

css mkdocs

4
推荐指数
1
解决办法
4296
查看次数

Flutter:带有圆形头像的卡片,突出显示

我想制作一张带有CircleAvatar,突出的卡片(您可以在这张图片中看到详细信息):

卡片

我不知道,它是如何工作的:/我尝试了一些带有 aStack和定位小部件的东西,但它没有用......

dart flutter

4
推荐指数
2
解决办法
7080
查看次数

如何让按钮跨越其所包含的卡片的宽度?

我正在使用 Angular v6 和 Angular Material 为 Web 项目构建首页。我想知道,如何使按钮拉伸的宽度与其出现的材料卡组件的宽度相匹配?

这是我的代码:

<div style="padding:5px">
  <mat-card>
    <button mat-button style="background-color: #008CBA; width:100%;">Portfolio</button>
    <button mat-button style="background-color: #008CBA; width:100%;">Portfolio</button>
    <button mat-button style="background-color: #008CBA; width:100%;">Portfolio</button>
  </mat-card>
</div>
Run Code Online (Sandbox Code Playgroud)

angular-material angular

4
推荐指数
1
解决办法
2783
查看次数

在 Angular Material 中使用两种不同的字体

我用自定义字体创建了自己的自定义主题:

@import '~@angular/material/theming';
@include mat-core();
$custom-typography: mat-typography-config($font-family: '"work sans",    sans-serif;');
@include mat-core($custom-typography);
Run Code Online (Sandbox Code Playgroud)

现在我想为每个标题(h1-h6)使用字体“Oswald”。我怎样才能做到这一点?

angular-material angular

4
推荐指数
1
解决办法
1490
查看次数