NordicSemiconductor / Android-nRF-Toolbox

The nRF Toolbox is a container app that stores your Nordic Semiconductor apps for Bluetooth Low Energy in one location.
https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Toolbox
BSD 3-Clause "New" or "Revised" License
1.07k stars 461 forks source link

Android Studio 3.0 #34

Closed syslogic closed 6 years ago

syslogic commented 6 years ago

mSlider was null in landscape layout, because of inconsistent layout xml. therefore I've introduced the parent id layout_feature_uart, which is always present, in order to have a view, to construct the Snackbar.

syslogic commented 6 years ago

have also updated the build.gradle (alike this is build on current Android Studio), while still respecting the version code for China.

syslogic commented 6 years ago

now it builds again, with all support libraries using v26.0.1 ("percent" had the mismatch). the only downside is, that wear minimum version is now 23.

philips77 commented 6 years ago

Hi @syslogic Sorry for the late reply but I was on vacations. Thanks for the PR! A specially for migrating to Play Services 10.2, I wasn't aware of the update. Few questions:

  1. Why did you change LinearLayout to LinearLayoutCompat? https://github.com/NordicSemiconductor/Android-nRF-Toolbox/pull/34/commits/899e971708eb6527e6203049e910d14d713df807 Just to have aligned to End instead of Right, etc?
  2. Same for AppCompatTextView and AppCompatSpinner https://github.com/NordicSemiconductor/Android-nRF-Toolbox/pull/34/commits/99d6bf4ead1aee8ee1ed91cbef1e57a7f9ca40d7?

I'll probably have more questions when I finish reading it.

philips77 commented 6 years ago

For API 26 at least one channel must be created to show notifications. This may require some thinking :)

syslogic commented 6 years ago

version 10.2.0 also runs on the current emulator, which makes it more easy to test in general; have removed the files, because ./gradlew build will fetch them; that's also why I've chmod +x ./gradlew. that left/right vs. start/end is for RTL layout compatibility (in a LTR layout, one cannot notice any difference - but when it's Hebrew & Arabic... it will flip properly). think it's generally suggested to use the AppCompat classes (would need to see, if there actually is an official design guideline concerning that)... Android Studio at least shows a yellow index marker and complains, unless one fixed it.

that "channel" is just a String tag for a notification channel... eg. so that one can have several queues, for different kinds of events. while all notifications use the same channel, it should behave alike it did without having channels.

could update all the XML resources to use AppCompat classes... just hesitated because wasn't sure, if being accepted.

syslogic commented 6 years ago

there is also a new Wear UI library added, one just has to uncomment the reference in the build.gradle. merely commented it out, because it's not too relevant - and one can uncomment and then use it (it's more of a reminder, that it exists).

philips77 commented 6 years ago

My understanding was that the AppCompatActivity or the Compat layout inflater replaces all views to Compat versions automatically (for example ImageView to support vector drawables, etc.). RTL is not really needed in our case as we support only English... actually I should also add resConfigs "en" to build.gradle which will remove all other translations from support lib that are not supported.

syslogic commented 6 years ago

resConfig "en" might make no difference, while there is only 1 single localization present. while I don't think that it would replace anything automatically; here it is explained in detail what exactly it is good for: https://developer.android.com/topic/libraries/support-library/features.html when wanting to cut down on package size ./gradlew app:dependencies would list all the dependencies, while one can use that information to selectively exclude some. hence it's rather a reference application, too much optimization might only require people to add them again

syslogic commented 6 years ago

the flavor dimensions are handled differently with the 3.0.0 Gradle plugin, therefore I've removed all which appeared not essential (could add them back on demand). that version number workaround also was removed. noticed, that one can get the root-view in most situations with the built-in android.R.id.content - which would also fix the UART slider onOrientationChange force close, 899e971708eb6527e6203049e910d14d713df807. guess it should build against API 27, just I have no hardware device to test anything > API 25. not finishing off the Activity, while the is is no HCI available (at least for debug builds), would permit to run it against later API on the emulator.

philips77 commented 6 years ago

Hi, thanks again for the PR. I was actually doing some changes in the project before the PR, but I included many of your changes. Thanks for pointing that Wear 1.0 apps now can be distributed as Wear 2.0.

philips77 commented 6 years ago

Hi, I pushed my changes to the master branch. Many of your suggestions are included there. However, I was unable to make it compilable without this temporary fix in wear\build.gradle to replace all support libraries versions to 26.1.0. Let me close the PR now, you are welcome to create another one if you find I missed something.