Skip to content

Commit

Permalink
Revert fallback to ch340 and upper directions (for other manufacturers)
Browse files Browse the repository at this point in the history
  • Loading branch information
Snow4DV committed Oct 21, 2023
1 parent ccc64e4 commit 3d16e5b
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
minSdk 21
targetSdk 33
versionCode 1
versionName "1.4.2"
versionName "1.4.3"


testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
2 changes: 1 addition & 1 deletion app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.4.1w",
"versionName": "1.4.2",
"outputFile": "app-release.apk"
}
],
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private boolean connectToDevice(UsbDevice device) {
adapterProbeTable.addProduct(currentDevice.getVendorId(), currentDevice.getProductId(),
Ch34xSerialDriver.class); // TODO: add driver selection

UsbSerialProber prober = (false ? UsbSerialProber.getDefaultProber() : new UsbSerialProber(adapterProbeTable));
UsbSerialProber prober = (true ? UsbSerialProber.getDefaultProber() : new UsbSerialProber(adapterProbeTable));

UsbSerialDriver usbSerialDriver = prober
.findAllDrivers(manager).stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ data class AdapterState(
enum class FanDirection(val resourceId: Int, val stringId: Int) {
NONE(R.drawable.ic_fan_dir_none, R.string.climate_none), UP(R.drawable.ic_fan_dir_up, R.string.fan_up), DOWN(R.drawable.ic_fan_dir_down, R.string.fan_down),
UP_DOWN(R.drawable.ic_fan_dir_up_down, R.string.fan_up_and_down), DOWN_WINDSHIELD(R.drawable.ic_fan_dir_down_windshield, R.string.fan_down_windshield),
WINDSHIELD(R.drawable.ic_fan_dir_windshield, R.string.fan_windshield);
WINDSHIELD(R.drawable.ic_fan_dir_windshield, R.string.fan_windshield), UP_UPPER(R.drawable.ic_fan_dir_up_upper, R.string.fan_up_upper),
DOWN_UPPER(R.drawable.ic_fan_dir_down_upper, R.string.fan_down_upper), UP_DOWN_UPPER(R.drawable.ic_fan_dir_up_down_upper, R.string.fan_up_down_upper),
UPPER(R.drawable.ic_fan_dir_upper, R.string.fan_upper);

}

Expand All @@ -53,6 +55,10 @@ data class AdapterState(
3 -> FanDirection.DOWN
4 -> FanDirection.DOWN_WINDSHIELD
5 -> FanDirection.WINDSHIELD
6 -> FanDirection.UPPER
7 -> FanDirection.DOWN_UPPER
8 -> FanDirection.UP_UPPER
9 -> FanDirection.UP_DOWN_UPPER
else -> FanDirection.NONE
}
val fanLevel: FanLevel
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/res/drawable/ic_fan_dir_down_upper.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="340dp"
android:height="340dp"
android:viewportWidth="340"
android:viewportHeight="340">
<path
android:pathData="M279.4,86.8c-13.5,-4.7 -28.3,2.4 -33,15.9L215,192.5c-2.1,6 -7.8,10 -14.1,10h-30.3h-25h-10.2c-7,0 -13.6,3.4 -17.6,9.2l-55.4,79.8c-10.1,10.1 -10.1,26.5 0,36.6c10.1,10.1 26.5,10.1 36.6,0l41,-64.9c3.5,-5.6 9.7,-9 16.3,-9h54.6h19.6c10.7,0 20.3,-6.8 23.8,-16.9l12.2,-34.9l28.9,-82.8c1,-2.8 1.5,-5.7 1.5,-8.5C296.7,100.5 290,90.5 279.4,86.8z"
android:fillColor="#FFFFFFFF"/>
<path
android:pathData="M274.66,71.18a34.6,34.6 54.12,1 0,10.97 -68.33a34.6,34.6 54.12,1 0,-10.97 68.33z"
android:fillColor="#FFFFFFFF"/>
<path
android:pathData="M111.5,161.7H91v-48.1c0,-1.5 -1.2,-2.8 -2.8,-2.8H50.8c-1.5,0 -2.8,1.2 -2.8,2.8v48.1H27.5c-1.9,0 -3,2.1 -1.9,3.6l42,60.6c0.9,1.3 2.9,1.3 3.8,0l42,-60.6c1.1,-1.5 0,-3.6 -1.9,-3.6z"
android:fillColor="#FFFFFFFF"/>
<path
android:pathData="m67.6,7 l-42,60.6c-1.1,1.5 0,3.6 1.9,3.6H48v48.1c0,1.5 1.2,2.8 2.8,2.8H88.2C89.7,122.1 91,120.9 91,119.3V71.2h20.5c1.9,0 3,-2.1 1.9,-3.6L71.4,7C70.5,5.6 68.5,5.6 67.6,7Z"
android:fillColor="#FFFFFFFF"/>
</vector>
21 changes: 21 additions & 0 deletions app/src/main/res/drawable/ic_fan_dir_up_down_upper.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="340dp"
android:height="340dp"
android:viewportWidth="340"
android:viewportHeight="340">
<path
android:pathData="M279.4,86.8c-13.5,-4.7 -28.3,2.4 -33,15.9L215,192.5c-2.1,6 -7.8,10 -14.1,10h-30.3h-25h-10.2c-7,0 -13.6,3.4 -17.6,9.2l-55.4,79.8c-10.1,10.1 -10.1,26.5 0,36.6c10.1,10.1 26.5,10.1 36.6,0l41,-64.9c3.5,-5.6 9.7,-9 16.3,-9h54.6h19.6c10.7,0 20.3,-6.8 23.8,-16.9l12.2,-34.9l28.9,-82.8c1,-2.8 1.5,-5.7 1.5,-8.5C296.7,100.5 290,90.5 279.4,86.8z"
android:fillColor="#FFFFFFFF"/>
<path
android:pathData="M274.66,71.18a34.6,34.6 54.12,1 0,10.97 -68.33a34.6,34.6 54.12,1 0,-10.97 68.33z"
android:fillColor="#FFFFFFFF"/>
<path
android:pathData="M111.5,161.7H91v-48.1c0,-1.5 -1.2,-2.8 -2.8,-2.8H50.8c-1.5,0 -2.8,1.2 -2.8,2.8v48.1H27.5c-1.9,0 -3,2.1 -1.9,3.6l42,60.6c0.9,1.3 2.9,1.3 3.8,0l42,-60.6c1.1,-1.5 0,-3.6 -1.9,-3.6z"
android:fillColor="#FFFFFFFF"/>
<path
android:pathData="m218.81,108.9 l-60.6,-42c-1.5,-1.1 -3.6,0 -3.6,1.9v20.5h-48.1c-1.5,0 -2.8,1.2 -2.8,2.8v37.4c0,1.5 1.2,2.8 2.8,2.8h48.1v20.5c0,1.9 2.1,3 3.6,1.9l60.6,-42c1.4,-0.9 1.4,-2.9 0,-3.8z"
android:fillColor="#FFFFFFFF"/>
<path
android:pathData="m67.6,7 l-42,60.6c-1.1,1.5 0,3.6 1.9,3.6H48v48.1c0,1.5 1.2,2.8 2.8,2.8H88.2C89.7,122.1 91,120.9 91,119.3V71.2h20.5c1.9,0 3,-2.1 1.9,-3.6L71.4,7C70.5,5.6 68.5,5.6 67.6,7Z"
android:fillColor="#FFFFFFFF"/>
</vector>
18 changes: 18 additions & 0 deletions app/src/main/res/drawable/ic_fan_dir_up_upper.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="340dp"
android:height="340dp"
android:viewportWidth="340"
android:viewportHeight="340">
<path
android:pathData="M279.4,86.8c-13.5,-4.7 -28.3,2.4 -33,15.9L215,192.5c-2.1,6 -7.8,10 -14.1,10h-30.3h-25h-10.2c-7,0 -13.6,3.4 -17.6,9.2l-55.4,79.8c-10.1,10.1 -10.1,26.5 0,36.6c10.1,10.1 26.5,10.1 36.6,0l41,-64.9c3.5,-5.6 9.7,-9 16.3,-9h54.6h19.6c10.7,0 20.3,-6.8 23.8,-16.9l12.2,-34.9l28.9,-82.8c1,-2.8 1.5,-5.7 1.5,-8.5C296.7,100.5 290,90.5 279.4,86.8z"
android:fillColor="#FFFFFFFF"/>
<path
android:pathData="M274.66,71.18a34.6,34.6 54.12,1 0,10.97 -68.33a34.6,34.6 54.12,1 0,-10.97 68.33z"
android:fillColor="#FFFFFFFF"/>
<path
android:pathData="m218.81,108.9 l-60.6,-42c-1.5,-1.1 -3.6,0 -3.6,1.9v20.5h-48.1c-1.5,0 -2.8,1.2 -2.8,2.8v37.4c0,1.5 1.2,2.8 2.8,2.8h48.1v20.5c0,1.9 2.1,3 3.6,1.9l60.6,-42c1.4,-0.9 1.4,-2.9 0,-3.8z"
android:fillColor="#FFFFFFFF"/>
<path
android:pathData="m67.6,7 l-42,60.6c-1.1,1.5 0,3.6 1.9,3.6H48v48.1c0,1.5 1.2,2.8 2.8,2.8H88.2C89.7,122.1 91,120.9 91,119.3V71.2h20.5c1.9,0 3,-2.1 1.9,-3.6L71.4,7C70.5,5.6 68.5,5.6 67.6,7Z"
android:fillColor="#FFFFFFFF"/>
</vector>
15 changes: 15 additions & 0 deletions app/src/main/res/drawable/ic_fan_dir_upper.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="340dp"
android:height="340dp"
android:viewportWidth="340"
android:viewportHeight="340">
<path
android:pathData="M279.4,86.8c-13.5,-4.7 -28.3,2.4 -33,15.9L215,192.5c-2.1,6 -7.8,10 -14.1,10h-30.3h-25h-10.2c-7,0 -13.6,3.4 -17.6,9.2l-55.4,79.8c-10.1,10.1 -10.1,26.5 0,36.6c10.1,10.1 26.5,10.1 36.6,0l41,-64.9c3.5,-5.6 9.7,-9 16.3,-9h54.6h19.6c10.7,0 20.3,-6.8 23.8,-16.9l12.2,-34.9l28.9,-82.8c1,-2.8 1.5,-5.7 1.5,-8.5C296.7,100.5 290,90.5 279.4,86.8z"
android:fillColor="#FFFFFFFF"/>
<path
android:pathData="M274.66,71.18a34.6,34.6 54.12,1 0,10.97 -68.33a34.6,34.6 54.12,1 0,-10.97 68.33z"
android:fillColor="#FFFFFFFF"/>
<path
android:pathData="m67.6,7 l-42,60.6c-1.1,1.5 0,3.6 1.9,3.6H48v48.1c0,1.5 1.2,2.8 2.8,2.8H88.2C89.7,122.1 91,120.9 91,119.3V71.2h20.5c1.9,0 3,-2.1 1.9,-3.6L71.4,7C70.5,5.6 68.5,5.6 67.6,7Z"
android:fillColor="#FFFFFFFF"/>
</vector>
1 change: 1 addition & 0 deletions app/src/main/res/values-ru-rRU/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<string name="show_climate_status_through_notifications">Показывать состояние климата в уведомлениях</string>
<string name="notifications_summary">Производительность лучше, но менее интуитивно (отправляет состояние климата в уведомлениях)</string>
<string name="run_app">Запустить приложение</string>
<string name="fan_down_windshield">dsa</string>
<string name="climate_auto">Авто</string>
<string name="status_notification_channel_name">Уведомления о состоянии климата</string>
<string name="activity_offset">Смещение изображения главного экрана</string>
Expand Down
10 changes: 8 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,14 @@
<string name="climate_none" translatable="false">-</string>
<string name="fan_down" translatable="false">↓</string>
<string name="fan_up_and_down" translatable="false">↓→</string>
<string name="fan_down_windshield" translatable="false">[↑↓]️</string>
<string name="fan_windshield" translatable="false">[↑]</string>
<string name="fan_down_windshield" translatable="false">W↓️</string>
<string name="fan_windshield" translatable="false">W</string>

<string name="fan_up_down_upper" translatable="false">↑↓→</string>
<string name="fan_up_upper" translatable="false">↑→</string>
<string name="fan_down_upper" translatable="false">↓↑</string>
<string name="fan_upper" translatable="false">↑</string>

<string name="ac" translatable="false">AC</string>
<string name="climate_auto">AUTO</string>
<string name="climate_on">on</string>
Expand Down

0 comments on commit 3d16e5b

Please sign in to comment.