Updated on 2026-08-14
This commit is contained in:
parent
28066a7206
commit
c78902999e
5 changed files with 220 additions and 34 deletions
|
|
@ -1,25 +0,0 @@
|
|||
package com.tangem.domain.wallet;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
public class DeviceNFCAntennaLocation {
|
||||
|
||||
public float X;
|
||||
public float Y;
|
||||
public boolean OnBackSide;
|
||||
public float Strength;
|
||||
|
||||
public void getAntennaLocation() {
|
||||
String device = DeviceName.getDeviceName();
|
||||
String model = Build.DEVICE;
|
||||
this.X = 0.5f;
|
||||
this.Y = 0.33f;
|
||||
this.OnBackSide = true;
|
||||
this.Strength = 1.0f;
|
||||
// Samsung
|
||||
// if (model.contains("Samsung")) {this.Y = 0.33; this.Strength = 0.5; }
|
||||
// if (model.contains("Sony")) {this.Y = 0.33; this.Strength = 0.5; }
|
||||
// if (device == "Galaxy J5") {this.Y = 0.4; this.Strength = 0.5; }
|
||||
if (device == "P10 lite") {this.Y = 0.03f; this.Strength = 0.8f; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.tangem.domain.wallet
|
||||
|
||||
import android.os.Build
|
||||
import com.tangem.domain.NFCLocation
|
||||
|
||||
class DeviceNFCAntennaLocation {
|
||||
val TAG: String = DeviceNFCAntennaLocation::class.java.simpleName
|
||||
|
||||
var orientation: Int = 0
|
||||
var fullName: String = ""
|
||||
var x: Float = 0.toFloat()
|
||||
var y: Float = 0.toFloat()
|
||||
var z: Float = 0.toFloat()
|
||||
var onBackSide: Boolean = false
|
||||
var strength: Float = 0.toFloat()
|
||||
|
||||
fun getAntennaLocation() {
|
||||
val codename = Build.DEVICE
|
||||
|
||||
// default values
|
||||
this.orientation = 0
|
||||
this.fullName = ""
|
||||
this.x = 0.5f
|
||||
this.y = 0.35f
|
||||
this.z = 0f
|
||||
this.onBackSide = true
|
||||
this.strength = 1.0f
|
||||
|
||||
for (nfcLocation in NFCLocation.values()) {
|
||||
if (codename == nfcLocation.codename) {
|
||||
this.fullName = nfcLocation.fullName
|
||||
this.orientation = nfcLocation.orientation
|
||||
this.x = nfcLocation.x / 100f
|
||||
this.y = nfcLocation.y / 100f
|
||||
this.z = nfcLocation.z / 100f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue