【问题标题】:How to test low-bit ambient and burn-in protection when making watch faces?制作表盘时如何测试低位环境和老化保护?
【发布时间】:2014-12-31 14:33:24
【问题描述】:

Android Wear 的表盘 API 需要对某些屏幕进行特殊考虑,即需要低位环境和老化保护的屏幕 (see the design guide)。

我只有默认情况下不使用这两种模式的手表。在开发表盘时,在没有特定手表的情况下测试这些模式的最佳方法是什么?

【问题讨论】:

    标签: wear-os watch-face-api


    【解决方案1】:

    您将通过WatchFaceService.Engine.onPropertiesChanged 回调收到有关老化保护和低环境的信息。例如:

        @Override
        public void onPropertiesChanged(Bundle properties) {
            super.onPropertiesChanged(properties);
            mLowBitAmbient = properties.getBoolean(PROPERTY_LOW_BIT_AMBIENT, false);
            boolean burnInProtection = properties.getBoolean(PROPERTY_BURN_IN_PROTECTION, false);
            mHourPaint.setTypeface(burnInProtection ? NORMAL_TYPEFACE : BOLD_TYPEFACE);
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "onPropertiesChanged: low-bit ambient = " + mLowBitAmbient);
            }
        }
    

    如果要测试,直接设置值即可:

        mLowAmbient = true;
        boolean burnInProtection = true;
    

    并运行您的代码以查看它是否呈现表盘。在这种情况下,您应该渲染表盘,就好像它处于低环境中并具有烧伤保护。检查所有 4 种组合,一切顺利,您可以返回从捆绑包中获取值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-21
      相关资源
      最近更新 更多