mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-03 00:43:02 +01:00
Bangle.js build flavor (#2621)
This PR adds build flavors to `build.gradle`. The default is called `main`, but we also add `banglejs` which allows the building of an app called `Bangle.js Gadgetbridge`. This will have internet connectivity, allowing Bangle.js watches to request data directly from the internet - and it's named so as hopefully not to be confused with the normal offline Gadgetbridge, while still giving credit. Eventually the plan is to put this on the Google Play store, and to have additions in it which are good for Bangle.js users but would otherwise negatively impact normal Gadgetbridge users (a build flavor is used so we can keep the same codebase and not fork). About naming - I'd mentioned `Gadgetbridge for Bangle` to @ashimokawa but thinking about how it would appear in the app store and Android apps list, it probably makes sense to call it `Bangle.js Gadgetbridge` so it's listed under `B...`. Happy to change or use something else if you have strong opinions though. **Note:** adding build flavors seems to add the flavor name to existing builds. As a result, *all other builds will now have `main` in the name*. Unfortunately I didn't see another way around this, but hopefully it won't break anything. Co-authored-by: Gordon Williams <gw@pur3.co.uk> Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/2621 Co-authored-by: gfwilliams <gfwilliams@noreply.codeberg.org> Co-committed-by: gfwilliams <gfwilliams@noreply.codeberg.org>
This commit is contained in:
parent
ebdec4bdd0
commit
2cb5844020
@ -41,6 +41,7 @@ vendor's servers.
|
||||
- T-Rex [**\[!\]**](#special-pairing-procedures)
|
||||
- Verge Lite [**\[!\]**](#special-pairing-procedures)
|
||||
- [X ](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Mi-Band-5) [**\[!\]**](#special-pairing-procedures)
|
||||
- [Bangle.js](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Bangle.js)
|
||||
- BFH-16
|
||||
- [Casio](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Casio)
|
||||
- Casio GB-X6900B
|
||||
|
@ -60,6 +60,7 @@ android {
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
multiDexEnabled true
|
||||
buildConfigField "String", "GIT_HASH_SHORT", "\"${getGitHashShort()}\""
|
||||
buildConfigField "boolean", "INTERNET_ACCESS", "false"
|
||||
resValue "string", "pebble_content_provider", "com.getpebble.android.provider"
|
||||
}
|
||||
signingConfigs {
|
||||
@ -121,6 +122,27 @@ android {
|
||||
|
||||
}
|
||||
|
||||
flavorDimensions "device_type"
|
||||
productFlavors {
|
||||
main {
|
||||
// Ensure that when starting from scratch, 'main' is selected, not 'banglejs'
|
||||
getIsDefault().set(true)
|
||||
// the default build product flavor
|
||||
dimension "device_type"
|
||||
//applicationIdSuffix ""
|
||||
//versionNameSuffix ""
|
||||
}
|
||||
banglejs {
|
||||
dimension "device_type"
|
||||
applicationId "com.espruino.gadgetbridge"
|
||||
applicationIdSuffix ".banglejs"
|
||||
versionNameSuffix "-banglejs"
|
||||
buildConfigField "boolean", "INTERNET_ACCESS", "true"
|
||||
// Disable pebble provider to allow Bangle.js Gadgetbridge to coexist with Gadgetbridge
|
||||
resValue "string", "pebble_content_provider", "com.getpebble.android.nopebble.provider"
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError ABORT_ON_CHECK_FAILURE
|
||||
lintConfig file("${project.rootDir}/config/lint/lint.xml")
|
||||
@ -195,6 +217,7 @@ dependencies {
|
||||
implementation 'com.github.wax911:android-emojify:0.1.7'
|
||||
implementation 'com.google.protobuf:protobuf-lite:3.0.1'
|
||||
implementation "androidx.multidex:multidex:2.0.1"
|
||||
implementation 'com.android.volley:volley:1.2.1'
|
||||
}
|
||||
|
||||
preBuild.dependsOn(":GBDaoGenerator:genSources")
|
||||
|
5
app/src/banglejs/AndroidManifest.xml
Normal file
5
app/src/banglejs/AndroidManifest.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
</manifest>
|
72
app/src/banglejs/res/drawable/ic_launcher_foreground.xml
Normal file
72
app/src/banglejs/res/drawable/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,72 @@
|
||||
<vector android:height="652dp" android:viewportHeight="651.75745"
|
||||
android:viewportWidth="651.75745" android:width="652dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#000000"
|
||||
android:pathData="M4.395,0L647.362,0A5.273,4.395 90,0 1,651.757 5.273L651.757,646.485A5.273,4.395 90,0 1,647.362 651.758L4.395,651.758A5.273,4.395 90,0 1,-0 646.485L-0,5.273A5.273,4.395 90,0 1,4.395 0z"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.31811"/>
|
||||
<group>
|
||||
<clip-path android:pathData="M137.032,998.55L1528.284,998.55L1528.284,215.971L137.032,215.971Z"/>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="M488.99,417.594L484.347,417.594L484.347,402.013L488.99,402.013c0.852,-0 1.543,0.691 1.543,1.543L490.533,416.051C490.533,416.903 489.842,417.594 488.99,417.594"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m476.084,380.673 l-1.312,1.312 -7.454,-7.454 1.312,-1.312c1.032,-1.033 2.706,-1.033 3.738,-0L476.084,376.935C477.116,377.968 477.116,379.641 476.084,380.673"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m468.63,446.387 l-1.312,-1.312 7.454,-7.454 1.312,1.312c1.033,1.033 1.033,2.706 0,3.738L472.368,446.387C471.335,447.42 469.662,447.42 468.63,446.387"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m462.755,452.39l0,-3.575c0,-0 -17.441,6.416 -23.255,6.416 -5.814,-0 -23.255,-6.416 -23.255,-6.416L416.245,452.39c0,1.966 0.644,3.696 1.622,4.716 1.038,5.563 2.264,19.093 2.667,23.64 0,3.14 1.638,5.685 3.661,5.685l30.611,-0c2.022,-0 3.66,-2.545 3.66,-5.685l0,-0.001c0.403,-4.547 1.629,-18.077 2.668,-23.64C462.111,456.086 462.755,454.356 462.755,452.39"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m416.245,367.217l0,3.575c0,-0 17.441,-6.416 23.255,-6.416 5.814,-0 23.255,6.416 23.255,6.416L462.755,367.217c0,-1.966 -0.644,-3.696 -1.622,-4.716 -1.038,-5.563 -2.264,-19.093 -2.667,-23.64 0,-3.14 -1.638,-5.685 -3.66,-5.685L424.194,333.175c-2.022,-0 -3.66,2.546 -3.66,5.685l0,-0C420.131,343.408 418.905,356.938 417.866,362.5 416.889,363.521 416.245,365.25 416.245,367.217"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m406.365,376.668c-18.3,18.3 -18.3,47.97 0,66.27 18.3,18.3 47.97,18.3 66.27,-0 18.301,-18.3 18.3,-47.97 0,-66.27C454.335,358.368 424.665,358.368 406.365,376.668m62.269,62.269c-16.091,16.09 -42.178,16.09 -58.268,-0 -16.091,-16.091 -16.091,-42.178 -0.001,-58.269 16.091,-16.09 42.178,-16.09 58.269,-0 16.091,16.091 16.091,42.178 0,58.269"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="M195.008,427.752C191.39,430.98 186.965,432.594 181.734,432.594L163.118,432.594l0,-59.606l14.526,-0c4.619,-0 8.292,1.198 11.02,3.59 2.893,2.561 4.341,6.123 4.341,10.686 0,5.232 -2.143,9.072 -6.428,11.521C190.751,399.618 194.117,401.511 196.678,404.461 199.182,407.411 200.434,411.028 200.434,415.313 200.434,420.434 198.625,424.579 195.008,427.752m-8.766,-48.336c-2.283,-2.004 -5.065,-3.006 -8.348,-3.006L166.457,376.41L166.457,398.116l11.937,-0c3.227,-0 5.899,-1.002 8.015,-3.006 2.114,-2.004 3.172,-4.619 3.172,-7.848 0,-3.339 -1.114,-5.955 -3.34,-7.847m6.261,25.795c-2.838,-2.448 -6.401,-3.673 -10.686,-3.673L166.457,401.538L166.457,429.171l15.36,-0c4.229,-0 7.819,-1.28 10.769,-3.84 3.005,-2.559 4.508,-5.899 4.508,-10.018 0,-4.174 -1.531,-7.541 -4.591,-10.102"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m237.917,432.594l0,-5.927c-3.618,4.341 -8.21,6.511 -13.774,6.511 -5.009,-0 -9.212,-1.696 -12.606,-5.092 -3.451,-3.451 -5.177,-7.681 -5.177,-12.689 0,-5.009 1.698,-9.211 5.093,-12.606 3.45,-3.45 7.68,-5.176 12.689,-5.176 5.509,-0 10.101,2.17 13.774,6.512l0,-6.011L241.34,398.115L241.34,432.594ZM234.327,405.212c-2.838,-2.838 -6.233,-4.257 -10.184,-4.257 -4.007,-0 -7.403,1.391 -10.185,4.174 -2.838,2.838 -4.258,6.261 -4.258,10.268 0,3.952 1.42,7.346 4.258,10.184 2.838,2.839 6.232,4.258 10.185,4.258 4.006,-0 7.401,-1.391 10.184,-4.174 2.838,-2.839 4.258,-6.261 4.258,-10.268 0,-3.951 -1.42,-7.347 -4.258,-10.185"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m274.732,432.594l0,-20.62c0,-7.29 -3.285,-10.937 -9.85,-10.937 -3.229,-0 -5.677,0.948 -7.347,2.839 -1.725,1.893 -2.588,4.48 -2.588,7.763L254.947,432.594l-3.423,-0l0,-34.478l3.423,-0l0,4.174c1.558,-3.061 4.869,-4.592 9.935,-4.592 4.285,-0 7.568,1.225 9.85,3.673 2.282,2.45 3.423,5.873 3.423,10.268L278.155,432.594Z"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m316.89,444.114c-3.117,3.117 -7.208,4.675 -12.272,4.675 -9.406,-0 -15.026,-3.702 -16.863,-11.103l3.422,-0c0.612,2.726 2.366,4.759 5.26,6.094 2.281,1.056 5.009,1.586 8.181,1.586 4.285,-0 7.597,-1.197 9.934,-3.59 2.393,-2.393 3.59,-5.733 3.59,-10.018l0,-5.093c-3.618,4.341 -8.21,6.511 -13.774,6.511 -5.009,-0 -9.212,-1.696 -12.606,-5.092 -3.451,-3.451 -5.176,-7.681 -5.176,-12.689 0,-5.009 1.697,-9.211 5.093,-12.606 3.45,-3.45 7.681,-5.176 12.689,-5.176 5.509,-0 10.101,2.17 13.774,6.512L318.142,398.116L321.565,398.116L321.565,431.842C321.565,436.906 320.007,440.997 316.89,444.114m-2.338,-38.903c-2.838,-2.838 -6.233,-4.257 -10.184,-4.257 -4.007,-0 -7.403,1.391 -10.185,4.174 -2.838,2.838 -4.258,6.261 -4.258,10.268 0,3.952 1.42,7.346 4.258,10.185 2.838,2.838 6.232,4.257 10.185,4.257 4.006,-0 7.401,-1.391 10.184,-4.174 2.838,-2.839 4.258,-6.261 4.258,-10.268 0,-3.951 -1.42,-7.347 -4.258,-10.185"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
</group>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m329.326,367.888l3.34,-0L332.666,429.665l-3.34,-0z"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
<group>
|
||||
<clip-path android:pathData="M133.69,995.622L1524.942,995.622L1524.942,213.043L133.69,213.043Z"/>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m345.103,411.717c0,4.675 1.252,8.377 3.757,11.103 2.615,2.783 6.205,4.174 10.769,4.174 2.338,-0 4.452,-0.388 6.345,-1.168 2.392,-1.002 4.535,-3.033 6.428,-6.095l3.089,1.42c-2.171,4.119 -5.51,6.901 -10.018,8.348 -1.726,0.556 -3.674,0.835 -5.844,0.835 -5.176,-0 -9.434,-1.697 -12.773,-5.093 -3.396,-3.394 -5.093,-7.652 -5.093,-12.773 0,-5.176 1.67,-9.434 5.009,-12.773 3.393,-3.394 7.68,-5.093 12.856,-5.093 5.12,-0 9.35,1.586 12.689,4.759C375.712,402.534 377.411,406.653 377.411,411.717ZM368.645,400.78C366.029,398.889 363.023,397.942 359.629,397.942 352.505,397.942 347.829,401.448 345.604,408.461l27.966,-0c-0.557,-3.172 -2.199,-5.732 -4.925,-7.681"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
</group>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m435.285,411.261l1.746,-0l0,24.973l-1.746,-0z"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
<group>
|
||||
<clip-path android:pathData="M133.69,995.622L1524.942,995.622L1524.942,213.043L133.69,213.043Z"/>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m451.556,427.744c-1.136,0.966 -2.498,1.448 -4.089,1.448 -2.725,-0 -4.77,-1.235 -6.133,-3.705l1.491,-0.895c0.483,0.88 1.064,1.562 1.746,2.045 0.71,0.539 1.675,0.809 2.896,0.809 2.669,-0 4.003,-1.135 4.003,-3.408 0,-0.993 -0.468,-1.859 -1.405,-2.598 -0.285,-0.17 -0.689,-0.362 -1.214,-0.575 -0.526,-0.213 -1.172,-0.462 -1.938,-0.746 -1.42,-0.511 -2.442,-1.022 -3.066,-1.533 -0.909,-0.738 -1.363,-1.803 -1.363,-3.194 0,-1.193 0.454,-2.215 1.363,-3.067 0.88,-0.88 2.029,-1.32 3.449,-1.32 1.959,-0 3.62,0.681 4.983,2.044L451.003,414.158c-0.965,-0.965 -2.201,-1.448 -3.706,-1.448 -2.044,-0 -3.067,0.894 -3.067,2.683 0,0.795 0.312,1.448 0.938,1.959 0.511,0.399 1.32,0.782 2.427,1.15 0.964,0.341 1.76,0.66 2.385,0.959 0.625,0.298 1.093,0.561 1.406,0.788C452.606,421.185 453.217,422.448 453.217,424.038 453.217,425.572 452.664,426.807 451.556,427.744"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
</group>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m437.646,406.875c0,0.822 -0.666,1.488 -1.488,1.488 -0.822,-0 -1.488,-0.666 -1.488,-1.488 0,-0.822 0.667,-1.488 1.488,-1.488 0.822,-0 1.488,0.666 1.488,1.488"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
<path android:fillColor="#ffffff" android:fillType="nonZero"
|
||||
android:pathData="m438.109,402.347 l1.46,0.957 15.692,-23.932 -1.46,-0.958z"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1.84007"/>
|
||||
<path android:fillColor="#ffffff"
|
||||
android:pathData="M262.574,286.308m-70.193,0a70.193,70.193 45,1 1,140.385 0a70.193,70.193 45,1 1,-140.385 0"
|
||||
android:strokeColor="#00000000" android:strokeWidth="3.30771"/>
|
||||
<path android:fillColor="#008de4"
|
||||
android:pathData="m256.715,379.575c-19.655,-1.374 -38.812,-8.771 -53.855,-20.794 -3.999,-3.196 -11.197,-10.361 -14.382,-14.315 -11.11,-13.796 -18.274,-30.626 -20.677,-48.575 -0.67,-5.009 -0.67,-17.926 0,-22.935 2.448,-18.29 10.142,-36.068 21.399,-49.447 15.453,-18.366 35.936,-29.741 60.348,-33.514 5.552,-0.858 18.768,-0.979 24.368,-0.223 24.914,3.363 47.223,15.725 62.535,34.653 6.785,8.387 12.88,19.485 16.21,29.513 3.67,11.051 4.921,18.804 4.921,30.485 0,15.435 -3.055,28.599 -9.795,42.207 -10.586,21.373 -28.391,37.719 -50.732,46.576 -5.482,2.173 -15.632,5.003 -17.944,5.003 -0.266,-0 18.503,-12.673 37.207,-33.536l33.599,-37.476 -6.692,-5.016c-29.624,-22.207 -39.184,-43.496 -39.485,-43.311 -0.197,0.122 -0.307,0.053 -0.246,-0.153 0.132,-0.438 -7.522,-8.072 -7.976,-7.956 -0.169,0.043 -0.307,-0.194 -0.307,-0.527 0,-1.136 -8.362,-7.586 -9.835,-7.586 -0.365,-0 -2.034,-1.399 -3.708,-3.108 -1.674,-1.709 -4.242,-4.01 -5.706,-5.112 -1.464,-1.102 -2.85,-2.16 -3.08,-2.35 -0.23,-0.19 -0.67,-0.261 -0.978,-0.159 -0.311,0.104 -0.444,-0 -0.3,-0.235 0.325,-0.526 -2.508,-3.069 -3.048,-2.735 -0.217,0.134 -0.345,0.073 -0.283,-0.135 0.179,-0.603 -3.374,-3.401 -5.651,-4.451 -2.433,-1.122 -5.685,-1.806 -7.137,-1.502 -0.715,0.15 -2.692,2.295 -6.553,7.111 -3.041,3.793 -5.759,6.906 -6.041,6.919 -0.619,0.028 -0.695,0.842 -0.078,0.842 0.239,-0 0.325,0.176 0.192,0.391 -0.133,0.215 1.128,1.551 2.802,2.969 1.674,1.418 3.003,2.622 2.954,2.674 -0.049,0.052 -1.92,-0.708 -4.157,-1.69 -2.238,-0.982 -4.652,-1.912 -5.365,-2.066 -1.772,-0.383 -4.427,0.401 -5.871,1.735 -1.519,1.403 -13.509,23.553 -13.793,25.481 -0.187,1.265 1.165,4.197 11.091,24.067 11.82,23.66 12.4,25.095 10.382,25.705 -1.32,0.399 -3.182,2.221 -3.839,3.757 -0.401,0.937 -0.564,3.222 -0.564,7.897 0,7.137 0.282,8.439 2.214,10.221 1.061,0.979 1.084,1.098 0.821,4.331 -0.256,3.153 -0.211,3.418 0.863,5.137 2.885,4.614 21.556,27.429 25.029,30.583l1.015,0.921 -4.016,-0.072c-2.209,-0.039 -4.845,-0.13 -5.859,-0.2zM270.75,379.153c0.398,-0.104 0.951,-0.097 1.229,0.015 0.277,0.112 -0.049,0.197 -0.725,0.189 -0.676,-0.008 -0.903,-0.1 -0.504,-0.204zM274.223,378.756c0.282,-0.114 0.742,-0.114 1.024,-0 0.282,0.114 0.051,0.207 -0.512,0.207 -0.563,-0 -0.793,-0.093 -0.512,-0.207zM277.525,378.338c0.296,-0.118 0.649,-0.104 0.785,0.032 0.136,0.136 -0.106,0.233 -0.538,0.215 -0.477,-0.02 -0.574,-0.117 -0.247,-0.247zM285.873,341.144c0.008,-0.676 0.1,-0.903 0.204,-0.504 0.104,0.398 0.097,0.951 -0.015,1.229 -0.112,0.277 -0.197,-0.049 -0.189,-0.724zM285.416,314.49c0.02,-0.477 0.117,-0.574 0.247,-0.247 0.118,0.296 0.104,0.649 -0.032,0.785 -0.136,0.136 -0.233,-0.106 -0.215,-0.538zM258.418,297.937c0,-0.563 0.093,-0.794 0.207,-0.512 0.114,0.282 0.114,0.742 0,1.024 -0.114,0.282 -0.207,0.051 -0.207,-0.512zM282.44,295.61c0.296,-0.118 0.649,-0.104 0.785,0.032 0.136,0.136 -0.106,0.233 -0.538,0.215 -0.477,-0.02 -0.574,-0.117 -0.247,-0.247zM272.278,287.289c-0.369,-0.239 -0.42,-0.4 -0.127,-0.403 0.268,-0.003 0.602,0.178 0.741,0.403 0.314,0.508 0.172,0.508 -0.614,-0zM276.438,285.651c0,-0.563 0.093,-0.793 0.207,-0.512 0.114,0.282 0.114,0.742 0,1.024 -0.114,0.282 -0.207,0.051 -0.207,-0.512zM257.944,280.917c0,-0.802 0.154,-1.363 0.341,-1.247 0.323,0.2 0.153,2.704 -0.183,2.704 -0.087,-0 -0.158,-0.656 -0.158,-1.458zM256.203,271.045c0.282,-0.114 0.742,-0.114 1.024,-0 0.282,0.114 0.051,0.207 -0.512,0.207 -0.563,-0 -0.793,-0.093 -0.512,-0.207zM258.353,270.752c0,-0.085 0.323,-0.408 0.717,-0.717 0.65,-0.509 0.664,-0.495 0.155,0.155 -0.535,0.682 -0.871,0.899 -0.871,0.562zM253.746,266.522c0.507,-0.098 1.336,-0.098 1.843,-0 0.507,0.098 0.092,0.177 -0.921,0.177 -1.014,-0 -1.428,-0.08 -0.921,-0.177zM262.953,256.163c0,-0.788 0.084,-1.111 0.187,-0.717 0.103,0.394 0.103,1.039 0,1.433 -0.103,0.394 -0.187,0.072 -0.187,-0.717z" android:strokeWidth="2.50943"/>
|
||||
<path android:fillColor="#fb4f02"
|
||||
android:pathData="m240.419,339.853c-3.201,-1.591 -3.892,-3.868 -3.699,-12.194 0.159,-6.865 0.503,-8.021 2.891,-9.724l1.337,-0.954 22.08,-0.113 22.08,-0.113 1.56,1.033c2.764,1.829 3.017,2.739 3.017,10.865 0,7.984 -0.242,8.924 -2.758,10.718l-1.337,0.954 -21.911,0.099c-19.59,0.088 -22.054,0.028 -23.259,-0.571zM274.743,335.406c1.786,-0.924 2.04,-1.763 2.04,-6.753 0,-7.503 0.241,-7.372 -13.515,-7.372 -13.776,-0 -13.521,-0.14 -13.506,7.447 0.014,7.366 -0.166,7.268 13.424,7.284 8.459,0.01 10.581,-0.101 11.558,-0.606z" android:strokeWidth="2.50943"/>
|
||||
<path android:fillColor="#0276cb"
|
||||
android:pathData="m262.196,375.239c-10.425,-11.902 -22.682,-27.444 -22.682,-28.763 0,-0.117 10.505,-0.213 23.344,-0.213l23.344,-0l0,-3.099c0,-2.994 0.047,-3.144 1.393,-4.413 2.002,-1.889 2.389,-3.822 2.221,-11.093 -0.161,-6.954 -0.539,-8.171 -3.026,-9.761 -1.403,-0.897 -1.428,-0.961 -1.168,-2.964 0.781,-6.011 4.082,-13.816 10.844,-25.641 3.856,-6.744 6.667,-12.421 7.177,-14.495l0.302,-1.229 -1.023,1.229c-0.563,0.676 -2.004,2.703 -3.203,4.505 -9.492,14.265 -14.606,18.102 -20.394,15.3 -2.299,-1.113 -4.322,-3.131 -5.539,-5.527l-0.953,-1.875 -3.042,-0.102c-4.508,-0.151 -7.967,-2.022 -10.248,-5.542 -0.73,-1.127 -1.349,-2.049 -1.375,-2.049 -0.026,-0 0.007,4.193 0.074,9.317l0.121,9.317 -4.322,-12.286c-2.377,-6.758 -4.489,-12.345 -4.693,-12.416 -0.204,-0.071 -1.471,-0.84 -2.816,-1.71 -4.29,-2.773 -7.666,-8.132 -6.106,-9.692 0.584,-0.584 1.239,-0.526 7.171,0.632 7.945,1.552 9.531,1.591 11.749,0.291 4.453,-2.61 4.971,-9.515 0.993,-13.222 -0.529,-0.493 -3.296,-2.024 -6.149,-3.403 -3.738,-1.807 -6.064,-3.255 -8.324,-5.183 -1.725,-1.472 -3.049,-2.763 -2.942,-2.87 0.107,-0.107 3.36,1.119 7.229,2.724 3.869,1.605 7.188,2.861 7.375,2.792 0.398,-0.148 10.644,-13.396 10.949,-14.158 0.114,-0.284 -0.044,-0.834 -0.351,-1.221 -0.307,-0.387 0.197,-0.115 1.12,0.604 0.923,0.719 1.865,1.545 2.094,1.835 0.309,0.391 -1.051,2.409 -5.264,7.81l-5.681,7.283 1.627,2.155c2.113,2.798 3.304,5.54 3.583,8.243 0.43,4.169 -2.327,8.052 -6.801,9.577 -1.975,0.673 -6.749,0.592 -8.513,-0.145 -1.847,-0.772 -2.155,-0.508 -1.087,0.934 2.054,2.772 6.245,4.934 8.477,4.374 0.706,-0.177 4.32,-4.615 12.404,-15.235 6.274,-8.241 11.54,-15.184 11.703,-15.427 0.186,-0.279 0.815,0.088 1.7,0.991l1.404,1.433 -5.94,7.986c-3.267,4.392 -8.547,11.488 -11.734,15.768 -5.704,7.661 -5.794,7.814 -5.794,9.901 0,2.45 0.802,3.786 3.354,5.592 1.942,1.374 6.004,1.957 7.148,1.026 0.37,-0.301 5.853,-7.258 12.184,-15.461 9.256,-11.991 11.511,-15.156 11.511,-16.153l0,-1.24l2.002,2.228c1.697,1.888 1.888,2.259 1.256,2.433 -1.133,0.311 -21.618,27.334 -22.121,29.18 -1.06,3.894 2.404,8.089 6.678,8.089 3.103,-0 4.128,-1.01 13.208,-13.006l8.6,-11.362l0,-2.868c0,-2.275 -0.226,-3.333 -1.096,-5.119 -0.995,-2.044 0.164,-0.971 12.604,11.673 7.535,7.659 18.245,18.59 23.8,24.292l13.475,14.878c-5.84,15.359 -12.375,30.53 -26.942,43.512 -13.179,12.611 -29.511,20.35 -48.477,24.021l-4.891,0.607c-8.074,1.002 -7.284,1.248 -11.523,-3.591zM252.005,335.55c-1.951,-1.073 -2.234,-1.932 -2.243,-6.821 -0.015,-7.588 -0.27,-7.447 13.506,-7.447 13.756,-0 13.515,-0.131 13.515,7.372 0,7.512 0.252,7.376 -13.597,7.359 -6.742,-0.008 -10.648,-0.17 -11.181,-0.463zM242.381,237.324c0,-0.225 0.195,-0.41 0.434,-0.41 0.239,-0 0.32,0.184 0.181,0.41 -0.139,0.225 -0.334,0.41 -0.434,0.41 -0.099,-0 -0.181,-0.184 -0.181,-0.41z" android:strokeWidth="2.50943"/>
|
||||
</vector>
|
8
app/src/banglejs/res/values/strings.xml
Normal file
8
app/src/banglejs/res/values/strings.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
|
||||
<string name="app_name">Bangle.js Gadgetbridge</string>
|
||||
<string name="title_activity_controlcenter">Bangle.js Gadgetbridge</string>
|
||||
<string name="about_activity_title">About Bangle.js Gadgetbridge</string>
|
||||
<string name="about_description">Android companion app for Bangle.js built on top of the Gadgetbridge project, with added Internet Access.</string>
|
||||
<string name="gadgetbridge_running">Bangle.js running</string>
|
||||
</resources>
|
@ -65,6 +65,7 @@ import java.util.Set;
|
||||
import de.cketti.library.changelog.ChangeLog;
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
|
||||
import nodomain.freeyourgadget.gadgetbridge.adapter.GBDeviceAdapterv2;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBAccess;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||
@ -438,6 +439,12 @@ public class ControlCenterv2 extends AppCompatActivity
|
||||
}
|
||||
}
|
||||
|
||||
if (BuildConfig.INTERNET_ACCESS) {
|
||||
if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.INTERNET) == PackageManager.PERMISSION_DENIED) {
|
||||
wantedPermissions.add(Manifest.permission.INTERNET);
|
||||
}
|
||||
}
|
||||
|
||||
if (!wantedPermissions.isEmpty()) {
|
||||
Prefs prefs = GBApplication.getPrefs();
|
||||
// If this is not the first run, we can rely on
|
||||
|
@ -31,6 +31,13 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.android.volley.Request;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.RequestQueue;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.StringRequest;
|
||||
import com.android.volley.toolbox.Volley;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@ -270,6 +277,39 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||
}
|
||||
} break;
|
||||
case "http": {
|
||||
// FIXME: This should be behind a default-off option in Gadgetbridge settings
|
||||
RequestQueue queue = Volley.newRequestQueue(getContext());
|
||||
String url = json.getString("url");
|
||||
// Request a string response from the provided URL.
|
||||
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
JSONObject o = new JSONObject();
|
||||
try {
|
||||
o.put("t", "http");
|
||||
o.put("resp", response);
|
||||
} catch (JSONException e) {
|
||||
GB.toast(getContext(), "HTTP: " + e.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
|
||||
}
|
||||
uartTxJSON("http", o);
|
||||
}
|
||||
}, new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
JSONObject o = new JSONObject();
|
||||
try {
|
||||
o.put("t", "http");
|
||||
o.put("err", error.toString());
|
||||
} catch (JSONException e) {
|
||||
GB.toast(getContext(), "HTTP: " + e.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
|
||||
}
|
||||
uartTxJSON("http", o);
|
||||
}
|
||||
});
|
||||
queue.add(stringRequest);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -628,23 +668,34 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
|
||||
/** Convert a drawable to a bitmap, for use with bitmapToEspruino */
|
||||
public static Bitmap drawableToBitmap(Drawable drawable) {
|
||||
final int maxWidth = 32;
|
||||
final int maxHeight = 32;
|
||||
/* Return bitmap directly but only if it's small enough. It could be
|
||||
we have a bitmap but it's just too big to send direct to the bangle */
|
||||
if (drawable instanceof BitmapDrawable) {
|
||||
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
|
||||
if (bitmapDrawable.getBitmap() != null) {
|
||||
return bitmapDrawable.getBitmap();
|
||||
}
|
||||
Bitmap bmp = bitmapDrawable.getBitmap();
|
||||
if (bmp != null && bmp.getWidth()<=maxWidth && bmp.getHeight()<=maxHeight)
|
||||
return bmp;
|
||||
}
|
||||
int w = 24;
|
||||
int h = 24;
|
||||
/* Otherwise render this to a bitmap ourselves.. work out size */
|
||||
int w = maxWidth;
|
||||
int h = maxHeight;
|
||||
if (drawable.getIntrinsicWidth() > 0 && drawable.getIntrinsicHeight() > 0) {
|
||||
w = drawable.getIntrinsicWidth();
|
||||
h = drawable.getIntrinsicHeight();
|
||||
// don't allocate anything too big
|
||||
if (w>24) w=24;
|
||||
if (h>24) h=24;
|
||||
// don't allocate anything too big, but keep the ratio
|
||||
if (w>maxWidth) {
|
||||
h = h * maxWidth / w;
|
||||
w = maxWidth;
|
||||
}
|
||||
if (h>maxHeight) {
|
||||
w = w * maxHeight / h;
|
||||
h = maxHeight;
|
||||
}
|
||||
}
|
||||
/* render */
|
||||
Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); // Single color bitmap will be created of 1x1 pixel
|
||||
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||
drawable.draw(canvas);
|
||||
|
Loading…
Reference in New Issue
Block a user