我正在使用pass sdk v1.2.1,根据programming guide,有一种方法可以更改指纹对话框中显示的待机文本。该指南说您必须检查功能A star (*) next to a name means that the command is disabled.
是否可以调用Spass.DEVICE_FINGERPRINT_AVAILABLE_PASSWORD
,如下所示:
changeStandbyString
我尝试在带有Android 6.0和Galaxy S5 Android 5.x.x的Galaxy S5上使用它我都得到了异常
if(pass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT_AVAILABLE_PASSWORD)) {
mSpassFingerprint.changeStandbyString("Touch your fingerprint or press the button for launching own menu”);
}
看起来有点奇怪的是,如果IllegalStateException: setStandbyString is not supported.
中的方法返回true,则会调用异常,结果与检查时调用的方法相同
changeStandbyString
看起来好像有什么不对,有什么想法吗?
这是使用android studio调试时生成的代码:
isFeatureEnabled(Spass.DEVICE_FINGERPRINT_AVAILABLE_PASSWORD);
请注意,方法public void changeStandbyString(String var1) {
this.f();
if(this.d()) {
throw new IllegalStateException("setStandbyString is not supported.");
} else if(var1 == null) {
throw new IllegalArgumentException("the standby text passed is null.");
} else if(var1.length() > 100) {
throw new IllegalArgumentException("the standby text passed is longer than 100 characters.");
} else {
this.m = var1;
}
}
public boolean isFeatureEnabled(int var1) {
if(this.a == null) {
throw new IllegalStateException("initialize() is not Called first.");
} else {
switch(var1) {
case 0:
return this.a.a();
case 1:
case 2:
return this.a.b();
case 3:
return this.a.c();
case 4:
return this.a.d();
default:
throw new IllegalArgumentException("type passed is not valid");
}
}
}
是在两种情况下调用的方法,当您检查要素以查看是否启用以及何时更改文本时,d()
看起来应该{ {1}},就像其他方法一样:
if(!this.d())
此处changeStandbyString
仅在public void setDialogTitle(String var1, int var2) {
this.f();
if(!this.b()) {
throw new IllegalStateException("setDialogTitle is not supported.");
} else if(var1 == null) {
throw new IllegalArgumentException("the titletext passed is null.");
} else if(var1.length() > 256) {
throw new IllegalArgumentException("the title text passed is longer than 256 characters.");
} else if(var2 >>> 24 != 0) {
throw new IllegalArgumentException("alpha value is not supported in the titleColor.");
} else {
this.f = var1;
this.g = var2 + -16777216;
}
}
返回false时发生,这是throw new IllegalStateException("setDialogTitle is not supported.");
this.b()
时isFeaturedEnabled
调用的方法。
答案 0 :(得分:0)
编程指南doc是错误的。如果isFeatureEnabled(Spass. DEVICE_FINGERPRINT_AVAILABLE_PASSWORD)
返回false,则可以激活此功能。您可以查看code samples,详细了解如何使用此功能。