Merge branch 'dev' into omnipod_eros_andy

This commit is contained in:
Andy Rozman 2019-10-28 16:42:57 +00:00
commit 80c4697cad
3 changed files with 24 additions and 11 deletions

View file

@ -104,17 +104,14 @@ class ObjectivesFragment : Fragment() {
for (i in 0 until ObjectivesPlugin.objectives.size) {
val objective = ObjectivesPlugin.objectives[i]
if (!objective.isStarted || !objective.isAccomplished) {
val smoothScroller = object : LinearSmoothScroller(context!!) {
override fun getVerticalSnapPreference(): Int {
return SNAP_TO_START
}
override fun calculateTimeForScrolling(dx: Int): Int {
return super.calculateTimeForScrolling(dx) * 4
}
context?.let {
val smoothScroller = object : LinearSmoothScroller(it) {
override fun getVerticalSnapPreference(): Int = SNAP_TO_START
override fun calculateTimeForScrolling(dx: Int): Int = super.calculateTimeForScrolling(dx) * 4
}
smoothScroller.targetPosition = i
objectives_recyclerview.layoutManager?.startSmoothScroll(smoothScroller)
}
break
}
}

View file

@ -160,11 +160,12 @@ public class SignatureVerifierPlugin extends PluginBase implements ConstraintsIn
return sb.toString();
}
private String singleCharUnMap(String shortHash) {
public String singleCharUnMap(String shortHash) {
byte[] array = new byte[shortHash.length()];
StringBuilder sb = new StringBuilder();
for (int i = 0; i < array.length; i++) {
sb.append(String.format("%02x",(int) map.charAt(map.indexOf(shortHash.charAt(i)))));
if (i != 0) sb.append(":");
sb.append(String.format("%02X", 0xFF & map.charAt(map.indexOf(shortHash.charAt(i)))));
}
return sb.toString();
}

View file

@ -0,0 +1,15 @@
package info.nightscout.androidaps.plugins.constraints.signatureVerifier
import org.junit.Test
import org.junit.Assert.*
class SignatureVerifierPluginTest {
@Test
fun singleCharUnMapTest() {
val key = "2ΙšÄΠΒϨÒÇeЄtЄЗž-*Ж*ZcHijЊÄœ<|x\"Ε"
val unmapped = SignatureVerifierPlugin.getPlugin().singleCharUnMap(key)
assertEquals("32:99:61:C4:A0:92:E8:D2:C7:65:04:74:04:17:7E:2D:2A:16:2A:5A:63:48:69:6A:0A:C4:53:3C:7C:78:22:95", unmapped)
}
}