mirror of
https://github.com/adolfintel/OpenPods.git
synced 2026-09-14 14:56:11 -04:00
Updated pro support
This commit is contained in:
@@ -46,8 +46,9 @@ public class PodsService extends Service {
|
||||
|
||||
private static BluetoothLeScanner btScanner;
|
||||
private static int leftStatus=15, rightStatus=15, caseStatus=15;
|
||||
private static boolean chargeL=false, chargeR=false, chargeCase=false,
|
||||
pro=false; //todo: replace boolean switch for support of multiple models
|
||||
private static boolean chargeL=false, chargeR=false, chargeCase=false;
|
||||
private static final String MODEL_AIRPODS_NORMAL="airpods12", MODEL_AIRPODS_PRO="airpodspro";
|
||||
private static String model=MODEL_AIRPODS_NORMAL;
|
||||
|
||||
/**
|
||||
* The following method (startAirPodsScanner) creates a bluetoth LE scanner.
|
||||
@@ -153,7 +154,7 @@ public class PodsService extends Service {
|
||||
chargeL = (chargeStatus & 0b00000001) != 0;
|
||||
chargeR = (chargeStatus & 0b00000010) != 0;
|
||||
chargeCase = (chargeStatus & 0b00000100) != 0;
|
||||
pro = a.charAt(7)=='E'; //detect if these are AirPods pro or regular ones
|
||||
if(a.charAt(7)=='E') model = MODEL_AIRPODS_PRO; else model = MODEL_AIRPODS_NORMAL; //detect if these are AirPods pro or regular ones
|
||||
lastSeenConnected = System.currentTimeMillis();
|
||||
} catch (Throwable t) {
|
||||
if(ENABLE_LOGGING) Log.d(TAG, "" + t);
|
||||
@@ -279,21 +280,21 @@ public class PodsService extends Service {
|
||||
mBuilder.setCustomBigContentView(locationDisabledBig);
|
||||
}
|
||||
if(notificationShowing){
|
||||
if(ENABLE_LOGGING) Log.d(TAG,"Left: "+leftStatus+(chargeL?"+":"")+" "+"Right: "+rightStatus+(chargeR?"+":"")+" "+"Case: "+caseStatus+(chargeCase?"+":"")+" "+"Pro: "+pro);
|
||||
if(pro){
|
||||
notificationBig.setImageViewResource(R.id.leftPodImg, leftStatus <= 10 ? R.drawable.left_podpro : R.drawable.left_podpro_disconnected);
|
||||
notificationBig.setImageViewResource(R.id.rightPodImg, rightStatus <= 10 ? R.drawable.right_podpro : R.drawable.right_podpro_disconnected);
|
||||
notificationBig.setImageViewResource(R.id.podCaseImg, caseStatus <= 10 ? R.drawable.podpro_case : R.drawable.podpro_case_disconnected);
|
||||
notificationSmall.setImageViewResource(R.id.leftPodImg, leftStatus <= 10 ? R.drawable.left_podpro : R.drawable.left_podpro_disconnected);
|
||||
notificationSmall.setImageViewResource(R.id.rightPodImg, rightStatus <= 10 ? R.drawable.right_podpro : R.drawable.right_podpro_disconnected);
|
||||
notificationSmall.setImageViewResource(R.id.podCaseImg, caseStatus <= 10 ? R.drawable.podpro_case : R.drawable.podpro_case_disconnected);
|
||||
}else {
|
||||
if(ENABLE_LOGGING) Log.d(TAG,"Left: "+leftStatus+(chargeL?"+":"")+" "+"Right: "+rightStatus+(chargeR?"+":"")+" "+"Case: "+caseStatus+(chargeCase?"+":"")+" "+"Model: "+model);
|
||||
if(model.equals(MODEL_AIRPODS_NORMAL)){
|
||||
notificationBig.setImageViewResource(R.id.leftPodImg, leftStatus <= 10 ? R.drawable.left_pod : R.drawable.left_pod_disconnected);
|
||||
notificationBig.setImageViewResource(R.id.rightPodImg, rightStatus <= 10 ? R.drawable.right_pod : R.drawable.right_pod_disconnected);
|
||||
notificationBig.setImageViewResource(R.id.podCaseImg, caseStatus <= 10 ? R.drawable.pod_case : R.drawable.pod_case_disconnected);
|
||||
notificationSmall.setImageViewResource(R.id.leftPodImg, leftStatus <= 10 ? R.drawable.left_pod : R.drawable.left_pod_disconnected);
|
||||
notificationSmall.setImageViewResource(R.id.rightPodImg, rightStatus <= 10 ? R.drawable.right_pod : R.drawable.right_pod_disconnected);
|
||||
notificationSmall.setImageViewResource(R.id.podCaseImg, caseStatus <= 10 ? R.drawable.pod_case : R.drawable.pod_case_disconnected);
|
||||
}else if(model.equals(MODEL_AIRPODS_PRO)){
|
||||
notificationBig.setImageViewResource(R.id.leftPodImg, leftStatus <= 10 ? R.drawable.left_podpro : R.drawable.left_podpro_disconnected);
|
||||
notificationBig.setImageViewResource(R.id.rightPodImg, rightStatus <= 10 ? R.drawable.right_podpro : R.drawable.right_podpro_disconnected);
|
||||
notificationBig.setImageViewResource(R.id.podCaseImg, caseStatus <= 10 ? R.drawable.podpro_case : R.drawable.podpro_case_disconnected);
|
||||
notificationSmall.setImageViewResource(R.id.leftPodImg, leftStatus <= 10 ? R.drawable.left_podpro : R.drawable.left_podpro_disconnected);
|
||||
notificationSmall.setImageViewResource(R.id.rightPodImg, rightStatus <= 10 ? R.drawable.right_podpro : R.drawable.right_podpro_disconnected);
|
||||
notificationSmall.setImageViewResource(R.id.podCaseImg, caseStatus <= 10 ? R.drawable.podpro_case : R.drawable.podpro_case_disconnected);
|
||||
}
|
||||
if(System.currentTimeMillis()-lastSeenConnected<TIMEOUT_CONNECTED) {
|
||||
notificationBig.setViewVisibility(R.id.leftPodText, View.VISIBLE);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 29 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 29 KiB |
@@ -17,11 +17,12 @@
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="90dp"
|
||||
android:src="@drawable/left_pod"
|
||||
android:id="@+id/leftPodImg"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="6dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@@ -55,10 +56,12 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rightPodImg"
|
||||
android:layout_width="30dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:src="@drawable/right_pod" />
|
||||
android:src="@drawable/right_pod"
|
||||
android:layout_marginBottom="6dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
@@ -91,10 +94,12 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/podCaseImg"
|
||||
android:layout_width="60dp"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:src="@drawable/pod_case" />
|
||||
android:src="@drawable/pod_case"
|
||||
android:layout_marginBottom="6dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="15dp"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/left_pod"
|
||||
android:id="@+id/leftPodImg"
|
||||
@@ -53,7 +53,7 @@
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="15dp"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/right_pod"
|
||||
android:id="@+id/rightPodImg"
|
||||
@@ -90,7 +90,7 @@
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/pod_case"
|
||||
android:id="@+id/podCaseImg"
|
||||
|
||||
Reference in New Issue
Block a user