adolfintel / OpenPods

The Free and Open Source app for monitoring your AirPods on Android
https://fdossena.com/?p=openPods/index.frag
GNU General Public License v3.0
938 stars 161 forks source link

Migration to AndroidX, General improvements & Bug fixes #65

Closed Electric1447 closed 4 years ago

Electric1447 commented 4 years ago

Changes:

Pull requests and Issues adressed in this PR:

adolfintel commented 4 years ago

That's a big PR, thank you. Just a couple of things:

Electric1447 commented 4 years ago

I understand both of the points.

I'm trying to work on a workaround for api 29.

And on another note, I'm trying to implement dark theme while I'm at it.

adolfintel commented 4 years ago

You might want to merge the other PR as well, it already implements it but I haven't merged it yet because I was busy with other projects and university.

On May 11, 2020 9:51:24 AM GMT+02:00, Itai Levin notifications@github.com wrote:

I understand both of the points.

I'm trying to work on a workaround for api 29.

And on another note, I'm trying to implement dark theme while I'm at it.

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/adolfintel/OpenPods/pull/65#issuecomment-626534849 -- Sent from my Android device with K-9 Mail. Please excuse my brevity.

Electric1447 commented 4 years ago

👍

Electric1447 commented 4 years ago

Okay, I think I found a workaround for SDK 29. I'm currently doing more testing to see if it really fixed it.

Electric1447 commented 4 years ago

I added a few thinks and also merged the changes from #46 :

I also re-enabled ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS

adolfintel commented 4 years ago

Flipped shouldn't be a user preference as fas as I know, whether it is flipped or not is sent by the airpods.

Electric1447 commented 4 years ago

I fixed a bug where the charging symbol would sometimes be flipped. In PodsService.java:

String a = decodeHex(result.getScanRecord().getManufacturerSpecificData(76));

if (isFlipped(a)) {
    str = "" + a.charAt(12);
    str2 = "" + a.charAt(13);
} else {
    str = "" + a.charAt(13);
    str2 = "" + a.charAt(12);
}

chargeL = (chargeStatus & 0b00000001) != 0;
chargeR = (chargeStatus & 0b00000010) != 0;

As you can see above only the battery status are being fliped and not the charge status

String a = decodeHex(Objects.requireNonNull(Objects.requireNonNull(result.getScanRecord()).getManufacturerSpecificData(76)));
boolean flip = isFlipped(a);

if (prefs.getBoolean("flipPods", false))
    flip = !flip;

if (flip) {
    leftAirpodStr = "" + a.charAt(12);
    rightAirpodStr = "" + a.charAt(13);
} else {
    leftAirpodStr = "" + a.charAt(13);
    rightAirpodStr = "" + a.charAt(12);
}

if (flip) {
    chargeL = (chargeStatus & 0b00000010) != 0;
    chargeR = (chargeStatus & 0b00000001) != 0;
} else {
    chargeL = (chargeStatus & 0b00000001) != 0;
    chargeR = (chargeStatus & 0b00000010) != 0;
}

I've fixed it in here

Electric1447 commented 4 years ago

Flipped shouldn't be a user preference as fas as I know, whether it is flipped or not is sent by the airpods.

The option is disabled by default, the user will only activate it if he want to flip them again. I don't think it would be bad to keep this feature.

Electric1447 commented 4 years ago

Also I noticed that I made a mistake while migrating to AndroidX which broke SharedPreferences. I fixed it in a284bda

adolfintel commented 4 years ago

I don't think it would be bad to keep this feature.

Why though? Are there circumstances in which isFlipped doesn't work as intended?

Electric1447 commented 4 years ago

I don't know of any circumstances in which it shouldn't work as indicated.

However, l think it would be useful just in case it doesn't work as indicated.

At the end it is your app, so if you think I should remove it le me know.

adolfintel commented 4 years ago

I would remove it, it's kinda confusing if you don't know how the app works internally.

Btw, you're doing a great job, you did everything I wanted to do for version 1.4 and more. If you contact me at info@fdossena.com there is another thing I'd like to discuss privately. Thank you

Electric1447 commented 4 years ago

Btw my changes also include PR #46 & Issue #33 , so you can close them after the merge.

Electric1447 commented 4 years ago

I also fixed issue #64 I'm updating the 1st comment to add issues and pull requests to close once you merge.