tag:blogger.com,1999:blog-21889515683434152552024-03-13T22:35:48.738-05:00Kev said what?Musings on Android, iOS, OSX, C# and other PC based developmentMKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.comBlogger215125tag:blogger.com,1999:blog-2188951568343415255.post-23428466862450868332019-08-07T10:45:00.000-05:002019-08-07T10:45:15.194-05:00Random Android ThoughtsI have split my project into multiple modules. I have found that you can use 'api' in the core module and 'implementation' in the other modules and you only have to define the libraries once instead of in each module if they are shared. Pretty darn handy.<br />
<br />
One of the modules is loaded dynamically. Really like this Google feature as that module has a pretty hefty 3rd party library for live video and most users will not need it.<br />
<br />
Want to split out more modules but I really need to unwind some dependencies. Amazing what a maze of connections you code can become over time. Functions as needed but needs some work.<br />
<br />
I have also been breaking things down into Activities with Fragments. This has really helped my code flow. Now I have each fragment do a single thing, sets its results and values can be held in View Models and those areas that care use MutableLiveData to monitor the results.<br />
<br />
The new Fragment Navigation works really well. I like how I can view things ala iOS storyboards but with XML that I can manually edit.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-66129635724173791482019-04-19T09:42:00.004-05:002019-04-19T09:42:53.592-05:00Testing out FlutterIt was hack-a-thon days at work so I decided to try Flutter. I found a blank starter app then spent 10 Google Searches to about every two lines of code I actually wrote it seemed like. Flutter and Dart have both been evolving so much that a number of searches showed old information. At least most of the Stack Overflow stuff pointed you to the newer way of doing things.<br />
<br />
For the past two years I have been doing Kotlin so I kept forgetting to add ; to the end of lines. Already know the IDE but I did not want to pollute Android Studio so I grabbed IntelliJ and set up under that. Configuration was pretty straight forward and since I am on a MacBook I could test both iOS and Android builds. Did all the work on Android emulator then tried it on iOS from time to time.<br />
<br />
I used the Material look and I have zero if / then checks for Android or iOS. Small app so that does not prove a lot but for what I did I ran into no issues.<br />
<br />
App has an image, read from assets, and 6 buttons with icons from the Icons package and text in a grid layout to go to other areas. One button shows an Alert Dialog. One goes to a screen with a ListView. The ListView is populated with items I read from a JSON file in the assets area.<br />
<br />
I learned about Row, Column, Container, ListView, TextStyle, Expanded and all sorts of Widget properties. I have used a lot of layout managers over the years so I was able to get up to speed pretty quickly but I did a lot of searches to find what I needed and I refactored the layout code at least 6 times. Lots of indenting and easy to screw up a ( ) and [ ] matches or miss the ; at the end. The errors given by IDE generally pretty good.<br />
<br />
Imported Intl, DateFormat and Decimal. Wrote converters for JSON as I have Date Time and Decimal needs due to Double having accuracy issues. Learned how to grab a file from assets. I did not mess with any network stuff as you need to login with OAuth first to get to any of our data and that seems like it would eat up both days.<br />
<br />
Felt like I got a lot done in a day and a half. Very frustrating at first as getting anything simple to work took a lot of web searching and I went down so many wrong paths. First I was setting up the icon buttons as decorated columns then found I should be using FlatButton instead so I could get the actually tapped event and the tapped visual effects. Initial ListView code I found was very complicated but I found a simpler version and got it running quickly.<br />
<br />
So am I a Flutter convert? No, I just wanted to see what it is all about. We use a number of 3rd parties for interaction with Credit Card readers and what not that probably would be a massive pain to deal with in Flutter. I was impressed at the speed of testing stuff in my small two screen app. The instant run is nice. Having an identical app on two platforms is sweet. Setting up images sucked as you have to manually add them into the YAML file. I just want all things in a directory to be there. On-line help is all over the place, some old, some new, some expecting you to know a lot especially when they talk about packages. They don't always mention what to add to your YAML so you do another search to find out that info.<br />
<br />
Do I see some usages here? Kinda, like any app that appears to start out small you go "oh, I could do this simple app and get a free iOS version" but then you start adding more and more stuff then you hit some wall where you need something deeper in hardware and you are screwed.<br />
<br />
Next areas would be doing actual REST calls, doing complicated UI work, SQLite interaction, lifecycle fun, shared preferences, animations, and basically being a real full featured app.<br />
<br />
Glad I had time to play with it as was paid to do it. Time to save the code to Git and move back into my Kotlin reality. Worry is when I demo it this afternoon that the big bosses will think I found the holy grail of coding. Setting expectations is the key here.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-45726569599117064382018-09-21T15:54:00.001-05:002018-09-21T15:54:27.634-05:00Doing a little iOS work - Xcode is as bad as I rememberOur iOS programmer left. We have a new one starting next month. During the change over time I am doing some updates to the iOS code. Luckily before he left I got a pretty good overview of the current code so I am not running blind.<br />
<br />
The fun is always Xcode. Never have liked that IDE much but it has been a few years since I did iOS work so I figured it has had time to improve. While Swift may have improved the areas I use daily to code have not. Git support is still barebones so I had to use SourceTree. SourceTree is nice and all but I shouldn't have to leave the IDE to interact with source control. I almost never touch SourceTree when doing work in Android Studio. I can easily create branches, merge things, remove branches, check history etc. right in the tool I am already using. I guess Apple really does not care about improving this area because as far as I can tell zero changes here.<br />
<br />
Next up is searching. Yes Xcode gives you a number of ways to do it but it changes the mode a lot. If I look up usage of an enum, method or variable then the next time I search it is in that mode. I search for text a lot. Paying attention to the mode it is in because I right clicked on something in code but not on the search panel is frustrating.<br />
<br />
Archiving stinks. Who thought this was a good word for building for release? Archive to me means put something out to pasture, you are done with it, store it way as it is old. But here is means build the latest for the store or TestFlight. I battled provisions / certificates / other crap for 45 minutes to get things out on TestFlight. Then I build the IAP for a user and that took a long time. I just started the export and let it run but dang was it slow.<br />
<br />
There is also the wonderful fun of Interface Builder. So many tabs to get to settings. I will fully admit I like editing XML manually on Android. See all settings in one place, easy search and replaces as needed, easy to see cut and paste issues that I need to set up as styles. So much clicking in IB and you have to click on little [edit] links instead of on text. Might be powerful but it gets in your way when it comes to speed. Android gives me a choice, use visual editor if I want, manual if I don't. Yes IB generates XML but would you really manually edit what it creates? Last time I did a lot of iOS coding I skipped IB and did it all in code. Worked great for me as I am used to visualizing my layouts into manual XML creation. I used Masonry at the time so it was AutoLayout. Now that I use constraint layout on Android they are even closer.<br />
<br />
Was able to pull off the critical changes need for next weeks release. I have never programmed in Swift but it is similar enough to Kotlin, which I have used for past 18 months, it was not too hard. Reactive Swift too boot but again the Kotlin syntax leads you that direction as well.<br />
<br />
I came super close to downloading AppCode to use as a 30 day trial to get me over this hump until next dev appears. I may still do that if I have to spend much more time in the code. I have used AppCode at previous positions. Since it basically is same IDE as Android Studio I can hum right along using it and it works great with Git. Maybe I should just have work pony up for it anyway as I end up in the iOS code from time to time as it is. All my other Android tools are free so this can't be asking too much right?MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-18070840257993673432017-12-17T16:04:00.000-06:002017-12-17T16:04:03.082-06:00Going full ConstraintLayoutStarted a new project and decided to go full ConstraintLayout. I figure it is the future so I might as well use it. I used AutoLayout when I was doing iOS work so I have the general idea down.<br />
<br />
First off I am using 1.1 because it has Barriers, Guides and Groups. To properly replace TableLayouts you need Barriers. This allows you to say "Hey, here are X controls, I want an edge to be based on the longest one". This is what happens with stretched TableLayout columns. It also means your layout will adjust if you change text label widths which can easily happen in other languages. Trying to stay on top of the internationalization game.<br />
<br />
Group is nice if you need to hide a group of controls which you may need to do if you have a Switch that toggles visibility of a number of items.<br />
<br />
Guides allow you to do percentage layouts. This gets rid of that deprecated layout.<br />
<br />
Now my layouts are nice and flat. I went back to previous app and converted most of those layouts as well. The conversion tool in Android Studio is hit and miss. If you have just a RelativeLayout it will probably do a decent job converting it but you may have to set a width to 0dp here and there as the control may be set to start / end against another control but have a width of match_parent.<br />
<br />
I also find you have to put in spacer controls at the bottom of some layouts, especially row layouts used in a RecyclerView, as the bottom margin is ignored for the lowest item in a layout. Did not cause too many issues.<br />
<br />
I recommend you give this a shot as well.<br />
<br />
<br />
<br />
<br />MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-39081663303106689342017-10-20T15:58:00.002-05:002017-10-20T15:58:23.107-05:00Moved from minimum SDK 19 to 21Looking at our Flurry stats we had zero uses on SDK 19 so it was time to make the switch. Happy I did. I was able to delete a bunch of resolution dependent PNG files and move to vector based XML files.<br />
<br />
One minor issue, drawable start / end for a TextView, even the AppCompat version, does not support tint color until API 23. Easy enough, just did a separate ImageView and TextView to get the same look. Very few areas needed this change.<br />
<br />
I was also able to kill some code that was checking for older SDK versions. Nice to be able to clean up all that crap as well.<br />
<br />
Impact on final APK was minimal but I sure like the clean up in the resource area.<br />
<br />
I also started to use the applicationIdSuffix ".debug" in the build file. Now you can have the Play Store Version of the app and a new debug version on same device. Lets me see if I screwed up the look of things when I play with layouts.<br />
<br />
Decided to update the tint color for the status area of the screen as well. If you are running a debug version it is purple, light blue for release versions. Lets you instantly see what version you are running. Of course the launcher icon has a big BETA banner on it as well so you know at launch time which one you are using.<br />
<div>
<br /></div>
<div>
Knocking off some technical debt while I wait on server to have new features in place. Good to see some progress in this area.</div>
MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-79442142485823686692017-10-13T14:56:00.002-05:002017-10-13T14:56:51.526-05:00Removing ListView and PercentRelativeLayoutFor my tech debt I am removing all ListViews and Percent RelativeLayouts. List View has been replaced with RecyclerView. When I started the current app I did ListView, bad Kevin, because it was easy to pop into place especially since I was just learning Kotlin. Now that I have a lot of Recycler views and I can really use their power it is time to replace all the ListViews. I only have two left to go after swapping one out today. It was much easier than I set myself up for it being and since I now know to use multiple adapters instead of trying to cram everything into one adapter with crazy boolean logic it because super easy.<br />
<br />
One of the last two that needs replacing is of the infinite scroll variety so I will have to get that working. I have not done an infinite scroll for a RecyclerView yet.<br />
<br />
For PercentRelativeLayout I am swapping in ConstraintLayout. The auto conversion, at least with Android Studio 2.3, gets you 80% of the way there. I had to get the rest of it tweaked to look like it did before but it was not too bad. I can see the power of ConstraintLayout but the IDE has too many issues for me to want to switch everything to it. My understanding is AS 3.0 is much better but I will wait until that hits release. Did not want to have deprecated layouts in the code. I know Google will leave them around for a long time but learning ConstraintLayout was a good mental exercise. I have used auto layout for iOS development and MigLayout for desktop Java which made wrapping my head around ConstraintLayout pretty easy. A couple of videos to learn some tricks and I have not run into something I can't make it do. Looking forward to using the Group functionality in the 1.1 release as well.<br />
<br />
I have tested my code under AS 3.0 Beta. I had to replace one control I was using. It was from GitHub and has not been updated in a long time so chances of it getting fixed are slim. The replacement was not too hard to write and works out well plus I have a lot more control. Always happy to get rid of a 3rd party dependency especially when I get more power out of the end result.<br />
<br />
I tried using the ThreeTenAndroid library for time / date management but it was broken for Korea. After the start up crashes started to pile up it was time to switch. I am now using JODA Time. Was a pretty easy swap out. Not using standard Android Calendar / Date/ SimpleDataFormat as I was running into thread safety issues and was tired of screwing around with that. I know I added a bit to the size of my APK but working code is the best kind of code.<br />
<br />
Added more Flurry event calls for even more analytic reporting. I do find Flurry very handy for both our Android and iOS products. You only get as much out of it as you put into it. The Flurry webpage interface can be frustrating for sure but when it does work and the data comes back you get solid results. It does let me know when a new feature is being used. I have also found some features that are never used. Painful as that might be knowing the answer is good. I really wish they did a solid Android App so I could monitor error reports on my phone. Using the website on a phone sucks at best. The Android App is super limited in functionality to be nearly useless.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-32997777199719903832017-08-30T16:04:00.000-05:002017-08-30T16:04:01.000-05:00Updating to be more in compliance with Oreo ProgressDialog deprecation<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
Oreo deprecated the progress dialog. That big fun thing that would dim the screen, pop-up, show the spinning circle then disappear when whatever operation was done.</div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
The Google Material team is saying that is bad and users should be able to keep using the UI and cancel stuff. Once you target Android 26 any progress dialog usage gets flagged as a warning.</div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
At first I was thinking "Oh man this is going to suck, I can't do that" but then I started to try getting rid of it in a few places and by damned things look a lot better. You don't have that flicker effect where the screen dims, see dialog even if for a fleeting moment, the screen brightens again. I have removed calling the progress dialog from all the places that load data so far. It is only actually referenced in one helper area. I have also replace how that helper area works and I am showing a custom dialog fragment. It looks pretty much exactly like the old ProgressDialog but now I have no warnings in my code.</div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
The big benefit is user can cancel out of an operation if it is taking too long and move to another part of the app.</div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
Using Retrofit was a huge advantage here as it supports cancelling network calls. Really had to tweak just a little bit of code for that to work nicely. </div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
Finding the proper place to put the busy indicator in the UI takes a little bit of thinking. I use Recycler Views instead of List Views so I made a very simple recycler view adapter that hosts a piece of text and the horizontal indeterminate progress indicator. I set that as the recycler view adapter while I am busy doing network stuff such as loading the details I really want to show. The user can hit the BACK button on the action bar or the button on bottom of device and I exit the activity with no issues as I just cancel network operations in onDestroy. Otherwise once I have the data I swap in the adapter that shows it.</div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
It is really nice and clean looking and gives the user much better flexibility. Most of our network responses are pretty fast. There are a few areas we have to chain them to get all the data. It is funny watching QA hit something to start an operation then quickly try to pound the back button to make sure things cancel properly. I have some debug logging code in there so they can watch the output log to see if they truly did if fast enough. </div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
I am going to leave the progress dialog in place for credit card transaction processing and a few other key areas. I just can't have the user doing other things during that time. </div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
At first I was kind of pissed off at Google but once I got in there I totally see why they want you to stop using this UI freezer. The whole app feels cleaner and snappier. Very happy I tackled this area per the push from Google. Would love to kill it everywhere but some operations really do need to block the user from moving on.</div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div class="gmail_default" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
I also cleaned up some code where the user was entering things such as an order number for look up. If they entered an order number that did not exist in the system, easy to mistype this sort of thing, they got a big pop-up "Order Not Found" dialog. I got rid of that too and just show the order was not found in the existing UI, highlight the text and have it ready for them to retry. So much less jarring to the user and it just seems so much friendlier. You are not being yelled out, just told can't find it and right back to trying again without needing to hit a CANCEL button on some dialog that is yelling at you.</div>
MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-6517780815626505712017-07-28T14:16:00.001-05:002017-07-28T14:16:59.813-05:00Over a year in with Android watch and how it works with new phoneI have had my Huawei Android watch for over a year and now have a new HTC U11. I have worn a watch since I was in grade school so getting used to that part of the watch was super easy. My big concern was daily charging. I only need to charge it every two days and since I have multiple chargers at home and one at work that has not been an issue. Sure, it would be great if it lasted many days or had solar charging but it has not been the hassle I thought it might be.<br />
<br />
When I had my Note 4 running Marshmallow the watch always won when it came to bluetooth which was annoying when I got in the car. With the HTC U11 the phone lets the car win when I start it up. That is great as I want to make and receive calls on the hands free BT in my car always. I don't know if this magic is due to the phone or Nougat but I am darn happy it works.<br />
<br />
My watch updated to Android Wear 2.0 some time back. I was using Coffee for SMS support but no longer need to use that. Nice to have a keyboard right on the watch for quick replies. I have tested the drawing aspect as well and it works for sending back an emoji. Rest of the notifications work as expected and that is my favorite part of the watch. See the notification quickly and decide how much attention it needs.<br />
<br />
Both of my sons have Zen 2 watches and get a lot of use out of them as well. I have found the watch to be a solid purchase and would dearly miss it should it decide to stop working.<br />
<br />
Both the watch and phone have been solid in their pairing. I have not rebooted the watch since I got the new phone. I have rebooted the phone once outside of installing updates when it got overheated on a super hot day where I was also getting sick from heat stroke nearing conditions.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-10077611553540853062017-06-23T15:50:00.003-05:002017-06-23T15:50:52.732-05:00New HTC U11 to replace my Note 4I have been running the Note 4 that a previous company bought for me. Previous to that I had a Note 2. While I really like the Note series I was ready to be done with Samsung and the slow to never Android OS version updates. Newer Samsung phones are not cheap either and I buy my phones outright, not on a payment plan with the carrier. Personal choice.<br />
<br />
I researched what was out there and made some guesses about what was coming up. The HTC U11 seemed to hit the sweet spot for me. So far I have been very happy with the purchase.<br />
<br />
Pros of the U11<br />
<br />
<ul>
<li>Much faster. Pretty obvious that is is a newer device + processor so it should be</li>
<li>Nice to not have to look at USB cable every time you plug it in - no upside down mode</li>
<li>Responsive - I am not seeing lag when starting apps etc.</li>
<li>Solid sound. Note 4 was tinny at best and easy to block speaker when holding it normally</li>
<li>Rounded - easier on all parts of the hand to hold this device</li>
<li>Fast charging</li>
<li>Solid battery life even with lots of screen usage</li>
<li>Can finally do slo-mo videos </li>
<li>Solid camera</li>
<li>Comes with noise cancelling ear buds - sound good and do block the noise</li>
<li>I have Nougat</li>
<li>Squeeze to access camera. I think this is a handy usable gimmick.</li>
</ul>
<div>
Cons of the U11</div>
<div>
<ul>
<li>Lost my Stylus - did not use it a ton but when I did it was very helpful</li>
<li>Screen is not as vibrant with its colors - everything is crisp though</li>
<li>Non-removable battery. I did replace the battery on the Note 4 as it aged</li>
<li>No headphone jack but I rarely use headphones and it did come with a dongle to use with older headphones / earbuds.</li>
<li>No IR blaster. Another thing I used from time to time but did not rely upon.</li>
</ul>
<div>
The pros greatly outweigh the cons. This was a great upgrade and I am super happy with my purchase. Ordered off Amazon along with a few extra USB-C cables. We had some in the house for my wife's Axon 7 but not enough as I needed one in car, one at work, one for laptop and one for computer room where I use phone for debugging.</div>
</div>
<div>
<br /></div>
<div>
Surprised I had to install the HTC software on the Mac to be able to debug over USB. Mac usually does not care about drivers. Once configured it worked great and beats the heck out of using Android file transfer crap when I do want to get photos off the phone. APKs push so much faster to the device as well. Probably a mix of USB-C and faster device.</div>
<div>
<br /></div>
<div>
I don't have any complaints about the phone. It has taken everything I have tossed at it. </div>
<div>
<br /></div>
<div>
I did switch from Llama to Automagic. Llama was free and worked for years but it has not been updated in years and it was showing some issues with Nougat. Since Automagic is not free I tried the 10 day trial version off their website. After a day I paid for the full version. It has worked like a champ. I had to configure more to get my standard flows to work but it is more powerful. Wife was ready for a change as well so she is running Automagic now too. </div>
<div>
<br /></div>
<div>
My setup is pretty basic:</div>
<div>
Enter house -> enable WiFi and connect to it</div>
<div>
Leave house -> disable WiFi, set phone to normal sound</div>
<div>
Enter work -> enable WiFi, connect, set phone to vibrate</div>
<div>
Leave work -> disable WiFi, set phone to normal sound</div>
<div>
10:30 PM -> set phone to vibrate only mode</div>
<div>
6:30 AM -> set phone to normal sound</div>
<div>
<br /></div>
<div>
As for other phones I considered:</div>
<div>
<br /></div>
<div>
Waiting on Pixel 2. I knew it would get near instant Android updates but the current series was hard to find in stock, had crappy speakers like the Note 4 and probably would cost a couple hundred more than the U11. Plus my birthday / father's day was great time to do a phone upgrade. The wait was going to be for longer that I was willing to hold out.</div>
<div>
<br /></div>
<div>
OnePlus 5. I am just iffy on their long term support. After it came out I was happy I skipped this one. I like the quad res screen over 1080 especially for Google Cardboard.</div>
<div>
<br /></div>
<div>
Newer LG phones. Seems the boot loop issue and other quality issues around LG continue to haunt them. Nothing on the phones really jumped out at me.</div>
MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-62264402279865655872017-06-02T21:46:00.000-05:002017-06-02T21:46:56.411-05:00App is on the Play StoreDid the official release of the app Wednesday morning. By Friday I had over 10,000 installs. They did send out a bulk email to our current clients and many of them were hungry for the Android version. Various folks bought an iOS device and used that until the Android version was ready.<br />
<br />
Gotta say it is an ego boost to hit 10,000 installs in a few days. I do realize this will taper off now but I am still supporting 10k users as the sole developer, the iOS guy pitched in on some of the code, of the app.<br />
<br />
App is not 100% feature matched with iOS as of yet so I am working on adding the final matching features then we will work on improving the app and there are many other new features we will release in sync as time goes on.<br />
<br />
Reviews have been pretty positive. Some are having issues with data outside the apps control. They are addressing those issues at the server level. I am using Flurry to track various things and to capture any issues found. The Play Store is also catching crashes. So far there have been about 17 unique crash events affecting just a few people. I have been able to track down and solve most of them. Some have nothing in the stack trace for me to even guess what is happening and a few were in the Flurry Library.<br />
<br />
While I like Flurry the documentation is sad. You can't find any one place to tell you the latest version. Most of the official Flurry pages mention some flavor of 6.x but I found one place that said 7.0.0 so that was what I was using. I then decided to go to source, the jcenter repository, and found 7.1.1 was available. Since I had fixed a number of issues I had issues in this library I went ahead and did a fast followup release that I hope will knock things down close to zero other than maybe the issues that don't have a useful stack trace.<br />
<br />
I would say our QA department did a bang up job as the issues found have been very obscure and timing based. The app seems really solid.<br />
<br />
Excited to get more data out of Flurry as well. I have set up a couple of reports there already but I can tell the data is lagging a bit because I can see a lot more action in real-time than is getting reported in the Explorer. Once we have a good solid week of data it will be more interesting and we can monitor things over time.<br />
<br />
So why Flurry? At my last job we started using Google Analytics but it was just not cutting it for Mobile. Reporting with Fabric / Crashlytics did not seem to cover what we needed. Firebase seemed really powerful if you were willing to pay for BigData to do your queries. Flurry seemed to kind of hit the sweet spot for free data analysis. It is pretty easy to implement and a few simple helper bits for Kotlin and I was able to get a decent set of analytics in place in about a day.<br />
<br />
Next up on the learning side of things is constraints layouts. I can quickly layout everything I can think up with a mix of Relative, Linear, Table, and Grid layouts but Constraints is the future and the sooner I learn it the better. The conversion tools seems a bit iffy so learning from scratch is probably the way to go.<br />
<br />
I did get bit by the Java to Kotlin conversion tool as well. I had written an image cropping custom control in Java. Since I am doing full on Kotlin now and I needed to enhance this custom contol I had Android Studio convert it to Java. It compiled but did not work correctly. It decided to typecast a multiplication for me from Float to Int but I needed the multiplication to happen fully as a Float and the final result to be an Int. It decided to convert the code to case the number I was multiplying by first. Since that number was between 0.0 and 1.0 that cast was pointless. Simple enough to fix and I had a good idea what to do since I wrote the original code.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-69556287367617816552017-05-13T10:37:00.000-05:002017-05-13T10:40:48.727-05:002 months into Kotlin and the app is in BetaI have not quite been at the new job 2 months yet and I submitted the app to a closed Beta on the Google Play Store. First interaction with the new Play Store UI which was a bit frustrating. I got all the pieces in place finally. You have to jump around a lot between the app and managing the Beta email list.<br />
<br />
Feels darn good to have the app out there. It has been a bit of a challenge due to server side fun. There were some REST calls that seems quite silly and they worked them over so I sent / received a lot less traffic to do the work I needed.<br />
<br />
Learned how to use a 3rd party UPC scanner, credit card swiper and credit card signature control. The CC swiper was the hardest as the documentation was lacking and so, thanks to the fine decompiler in Android Studio, I ended up sniffing around the API the hard way to find what I wanted.<br />
<br />
Basic stats on the app<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">26 Activities</span><br />
<span style="font-family: Courier New, Courier, monospace;"> 9 Fragments</span><br />
<span style="font-family: Courier New, Courier, monospace;">11 Dialogs</span><br />
<span style="font-family: Courier New, Courier, monospace;">15 Adapters (ListView or RecyclerView)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> 5 Custom controls written by me</span><br />
<span style="font-family: Courier New, Courier, monospace;">59 Layouts (lots of row types)</span><br />
<span style="font-family: Courier New, Courier, monospace;">48 unique REST calls</span><br />
<br />
Not a small app but not massive either. All the code I wrote was in Kotlin, no Java on my side. For my first full Kotlin app I am very happy with the language. I would not switch back to Java at this time. I learned a ton and refactored a lot during the app development cycle. I kept finding better ways to do things in Kotlin saving even more lines of code. Support for round icons for Nougat and above. Making all the special permission asking calls as well. Not too many of them but the CC swiper needs to have access to the microphone, I need access to external storage and locations services.<br />
<br />
QA has been pretty smooth too. They are finding the edge case stuff because we have a great QA team. I just don't see NPE things which were always frustrating when doing Java coding. I have been able to knock out the bugs within an hour of them showing up in most cases.<br />
<br />
There is more to do on the app to get it in feature sync with the iOS version. What is there is very functional and fully usable by the target audience. It is also only being released to a small Beta team to start. I will continue to add the other features with a planned full release in early June. I need to deal with returns, some image capture and manipulation, and tie in to social media apps. There are parts of the Android app that are cleaner and easier to use than the iOS app so it also needs to get in sync with Android on that side. Good to have each team member push the other one.<br />
<br />
Late in testing we were having some timeouts with the credit card processing. 3rd party service we use. Default timeout is 10 seconds for Retrofit + OKHTTP. Upped that to 30 seconds and things went smoother. Very happy with Retrofit, OKHTTP and Moshi. Had not used them before. I was on Volley + GSON in the past. Don't miss Volley at all. Retrofit makes it super easy to set up the REST calls with annotations. Using Moshi because it is already being used by the OKHTTP stack so what the heck. No need to toss in another library.<br />
<br />
Time to enjoy the fact it was released and then start hammering away at the next parts of the app. Will be interesting to see what feedback we get from the Beta group. QA, other staff and myself had beat on it pretty hard. I pulled it into DDMS and went to each screen and did a kill process to make sure it survives that. Couple of tweaks there and all was fine. My first proguard configuration worked as well. I was able to run every part of the app. Hopefully this works fine on all the devices out there - looking at you Samsung.<br />
<br />
Went minimum SDK level of 19. I have tested on 480x800 displays as well. Figure that covers a massive majority of phones. My guess is most real world devices with be above 19 and with much larger screens. QA did testing on 7" tablets as well. No special tablet code in there as far as bonus layouts. I see some places that would be handy though.<br />
<br />
I have a Note 4 running Marshmallow and have been testing on that when not in an emulator. Good to have a Samsung Device for testing but I really want to upgrade my phone. Waiting for the new Pixel 2 and OnePlus 5 to arrive before I pull the triggerMKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-29257830512430495402017-04-02T12:17:00.001-05:002017-04-02T12:17:14.252-05:003 Weeks in using KotlinAfter using Kotlin for just three weeks I say it would be very hard to go back to Java. Everything takes less code, is just easier to do and the code readability just makes more sense. Part of it is using new libraries such as Retrofit as well. It is just super easy to set up a REST call.<div>
<br /></div>
<div>
I have created a small Kotlin utility that coverts JSON right out of Charles Proxy to best guess Kotlin objects used by Moshi. I am also use Moshi to pass the objects from one Activity to another. So nice to not need to configure a bunch of parameters to set in the Intent to send over data, just one and it contains the full object as a string that I convert right back to a full object when I get it on the other side. Every bit of data is there ready to use and it just takes one line on each side to send / receive.</div>
<div>
<br /></div>
<div>
I am up to 24 fragments / activities already. A bunch of adapters as I am using ListView when it fits and configured my first Kotlin RecyclerView as well. All pretty clean and easy and working like a champ. There is a ton of code that is done and a lot more to do. My Trello checklist keeps growing.</div>
<div>
<br /></div>
<div>
The iOS code uses a bar code scanner. I set that up on Friday. Went in really easily and with a lot less code that what the iOS guy had to do. I did create and swap out the icon for that action as iOS was using a camera which made no sense to me. On the iOS simulator a UIViewController showed up for a brief moment and disappeared so I had no idea what this area was even doing. I asked QA, who has a real device, and found out I needed a bar code scanner.</div>
<div>
<br /></div>
<div>
The switch to Kotlin should have happened some time back. It is hard to get yourself to do it on an existing product. I was totally starting from scratch here so it really was the perfect time to give it a shot. If I had gotten a little ways in and found I could not handle it I could have backed out and just gone Java. I force myself to keep going. Really were very few struggle areas and that was related to trying new 3rd party libraries and not Kotlin.</div>
<div>
<br /></div>
<div>
As I have worked along there has been a bit of code refactoring as I have found better ways to do things and I have taken cut / paste code and moved it into one location. You don't know it needs to be shared until you use it multiple times. I have a bunch of other ideas for refactoring as well running through my head this weekend that I will give a shot this week. Want to get the code as far along as possible for QA to be able to start in depth testing before I get too refactor crazy.</div>
<div>
<br /></div>
<div>
There is a need to connect to a credit card reader in the near future. I have not messed with that library yet. Hoping it is pretty straight forward. Something I might end up tackling this week.</div>
<div>
<br /></div>
<div>
I have been shooting for breadth over depth for the first three weeks. Get as menu drawer menu items to show something as possible. This might be the initial list and the first details screen. Next up is taking each screen and filling everything out. The ability to add a new order, the order detail screen, navigation form order to order etc. The order detail screen can be accessed from a lot of places and is key to things working. It will be RecyclerView based with a lot of business logic as to what to show when.</div>
<div>
<br /></div>
<div>
Knocking out all the main stuff gets the REST calls in place and allows me to demo a lot of aspects. Most of that is request / reply / show data so not much can go wrong. The next steps will be the business logic and where I actually POST / PUT stuff back to the server. Data validation, hide / show of controls, etc. and that is where the real meat of QA will reside. Set up to tackle a chuck of that this week. Kotlin probably does not help nor hinder that area. It is learning business logic and applying it in code. </div>
<div>
<br /></div>
<div>
Kotlin has won me over. I don't see going back to Java for Android.</div>
MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-48051098950885756162017-03-18T14:49:00.002-05:002017-03-18T14:49:40.991-05:00First week with KotlinGot my first nearly full week of Kotlin in place. I can't say full week as I started the new job on a Tuesday and there was training involved too. I have the iOS / Swift code to follow as well.<br />
<br />
I needed to grab the colors used by the client along with redoing one of the main graphics as an SVG image. Previously I had Adobe Illustrator but I don't have that now so I used Vectr (I know, odd spelling) which was fine for the minor image I needed to so. I also found Krita for graphics editing and I used that to size the Android icons. I used another online helper program to do the new rounded version of the icons as well. First time I have created a set of those.<br />
<br />
When working from home I used my personal PC to play music via Media Monkey + a helper program that exposed a web site for me to pause / skip songs. Don't have that working in an office so I started using Clementine but it has a bug where it double plays WMA songs which got annoying so I gave Vox a shot. Nice thing is I could drag and drop the playlist right out of Clementine into Vox and Vox has a plug-in so I can use the multi-media keys on the Microsoft Natural 4000 keyboard to play / pause and change the volume.<br />
<br />
Speaking of the keyboard, the first one failed. The space bar would either not work or it would repeat spaces forever. Took it back to Microcenter who does things in what I think is an odd manner. I just wanted to swap keyboard - bad for good - but they don't do that. They will refund the bad one and give you store credit then you have to go find the replacement and go back through the line again to buy it. Seems silly to me but I have a working keyboard. I have used this style of keyboard for a long time. Sure, they have died on me in the past after years of service but I have not had a bad one out of the box.<br />
<br />
While at Microcenter I also got a small laptop bag and a mouse pad. They want me to take the laptop home every night. No big deal, makes it easier if I need to work from home anyway. On that subject I ordered a USB C to mini-display port and USB-C to USB adapter to have at home so when I do work from home I can use my big monitor, keyboard and mouse. That showed up Friday from Amazon and they work just fine. There is a rumor I will get a separate power brick to have at home as well.<br />
<br />
Back to Kotlin. It is very handy that when you copy in Java code it will auto convert it to Kotlin. Makes learning stuff a ton easier as well. Kotlin sure uses a lot of lines of code to do the same thing. Copied in an enumeration where I had a couple of extra fields associated. Kotlin does it with a one line constructor. Since a lot of the work I have done has been the basic setup I have not really gotten deep into Kotlin yet.<br />
<br />
I got the first couple of screens ready, login and then the drawer based menu system. I stubbed out fragments for all the main screens and implemented the basic help screen as well. More colors, drawables and a few layouts. Also battled getting the actionbar colors I wanted with some help from Reddit. Demoed the app to the team and they were happy how far along I had gotten it.<br />
<br />
The <span style="font-family: Courier New, Courier, monospace;">build.gradle</span> files were my next target. I added some booleans so use the <span style="font-family: Courier New, Courier, monospace;">BuildConfig</span> file to control access to menu items. I also setup a <span style="font-family: Courier New, Courier, monospace;">version.properties</span> file so I can run tasks to update the build version string and build number for the command line as well. Tossed in some more libraries I knew I will be using in the next steps including play services so I can get a unique ID the Android way.<br />
<br />
Next up is getting Retrofit in place. That is where I will start next week. Need to find some decent tutorials on using it with Kotlin. Will tie in some dependency injection as well. There is some documentation for our REST calls but I am also using Charles Proxy to monitor what iOS is doing. Documentation gets out of date so seeing the raw JSON is usually the way to go. Plus I can see all the data in the request header and the response.<br />
<br />
I have not really looking into the Swift code yet. I have been in there to grab some assets including a special font they use. Of course I have the app working on the iOS simulator so I can check out the program flow and screen layouts.<br />
<br />
I also configured Slate so I can have a configuration for single screen when I detach at work and another configuration when I am running multiple monitors. Very handy to have all the windows move to the correct position when you start up as the Mac is great at starting the programs again but it sucks at getting them in the proper layout.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-21098100990269102512017-03-10T20:00:00.000-06:002017-03-10T20:00:48.618-06:00Moving to KotlinI am going to start a new job and my goal is to go Kotlin. I have been writing Android apps in Java for a number of years. Part of that time I also wrote iOS apps in ObjC. At the job I just left I only did Java Android programming.<br />
<br />
I learned a lot at the job including ButterKnife, Dagger, Google Analytics, Flurry Analytics, Event Bus, Twillio, BrainTree, Timber, Vector Drawables, and Glide. All of those things make Java programming easier. I also used a number of things that I used at previous jobs including Volley, GSON, AndroidSVG, and Google Play Services.<br />
<br />
Now it is time to move forward into the land of Kotlin. I have been using it for a number of smaller command line utilities. I had used Python for things like that in the past and I found I can whip them out just as quickly in Kotlin plus it let me learn a new language that I could also use for Android.<br />
<br />
I then stepped up and converted a small app that I had done in Java to Kotlin using the Anko library and then I wrote an animation test program from scratch from Kotlin using XML for the layout. Gave me a good peek into a number of aspects of Kotlin. I learned how to setup Kotlin for Android. My utilities were done with IntelliJ.<br />
<br />
The old company was moving away from native development so there was not desire there to change to a new native language even if we did it bits and pieces at a time. Sure there was no harm doing some one off utilities but no way I was going to get Kotlin into the main apps.<br />
<br />
Next up was taking some time to learn what libraries I might be able to use with Kotlin. There was an excellent talk by Jake Wharton about Okio. It started from the base of the pyramid and worked all the way up through OkHTTP, Moshi and Retrofit. Gave me a great understanding of the entire tree and what it is much better than NIO. Excited to use this chain of tools and to get away from the massive boilerplate of Volley when making REST calls. Annotations are your friend. <br />
<br />
Don't know if I will use DSL and Anko but I might use the SQLite aspects of it. I like some of what it offers but also like seeing the preview of my layouts in XML. I do plan on using ConstraintLayout as I have used MigLayout for Java desktop and Autolayout for iOS so I think I can pick it up pretty quickly. I can pull off all kinds of things with RelativeLayout, LinearLayout, TableLayout, GridLayout and PercentLayout bit it seems silly to keep mixing all those together.<br />
<br />
Scary to make all these changes at the same time. Kotlin will have me looking up how to do some things I already know to do easily in Java and general syntax. I have a decent base of knowledge now but I will probably fall back into old habits for speed. I know there is a lot of new syntax to use with Kotlin. Of course working code is what counts, using every trick may tighten up the code but is not a requirement. As I learn more I am sure I will go back to fairly fresh code and update it. Refactoring as you learn is a good idea.<br />
<br />
I have watched enough Kotlin videos to know what bits and pieces are there so I will attempt to use as much as I have learned. I also think the iOS code written in Swift by the current developer will help me make the switch as it has a lot of the same programming patterns used by Kotlin.<br />
<br />
Having a solid Android understanding is huge. I already know what I can do in Android, know about Activity and Fragment life cycles, know what the various Views do and can do recycler views with multiple row types. It will be more about learning syntax of a language and how to tie things together using Kotlin patterns.<br />
<br />
Nervous and excited for this new life adventure. Not going to miss the old semicolon and constant null pointer checks. Will take a little bit but I bet my programming speed increases and I actually end up writing less code than I have been writing in Java.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-80633766776002272452016-10-07T20:56:00.001-05:002016-10-07T20:56:24.568-05:00Got a new developer laptop, here are my thoughts on it so farI work from home and by the end of the day I am done sitting in my home office and am ready to spend some time around the family. I also work on some side projects and take some time to learn new things on my own outside of office hours.<br />
<br />
I want to pick up more Kotlin programming so I have been playing around with that. Having a laptop I can use in the family area made a lot of sense to me. I looked over a ton of machines, tried some out at Microcenter then did a lot more research.<br />
<br />
There were some initial requirements:<br />
15.6 - 17.3" screen<br />
Touchscreen<br />
16GB RAM minimum (OK with manual upgrade)<br />
256GB SSD minimum (OK with manual upgrade if multiple SSD slots)<br />
Decent video card - nVidia preferred<br />
Keyboard must have numeric keypad along with HOME, END, PG UP, PG DN keys<br />
Back lighting on the keyboard<br />
Ports to support multiple monitors<br />
<br />
I started with the ASUS ZenBook Pro UX501VW. Thought it would be great to have 5121GB SSD, no moving parts HDD. Nice and light as well. The problem? No END key, the power key is in that place. Of course you can turn off the num-lock and use that end key but I use the numeric keypad a lot as well. Plus it had a lot of glare to the screen and the reviews point out the color accuracy sucks especially for yellows. I tried one out at Microcenter and eliminated it but was very sad about that. It also has a pseudo 4K screen that does not play nice with all apps. Windows needs to catch up.<br />
<br />
Lots of people liked the MSI models. They require you to use the FN key to get to HOME and END so those were out as well. I looked at various Acer and HP models but each had a fatal flaw. I was getting close on some of the HP models. They seemed to have good screens, keyboards and sound systems. But I just could not do it. Once you starting adding touch screen, the memory and SSD the prices started to jump quickly.<br />
<br />
Then I found the Asus G725VL on the Microsoft store for $500 off. Hit all the requirements<br />
<br />
17.3" touchsreen<br />
24 GB of RAM<br />
256 GB SSD<br />
1T HD<br />
965M nVidia video card<br />
Full keyboard with numpad, separate HOME, END, PG UP, PG DN keys<br />
Fast charge USB port that even works when laptop is off<br />
Multiple ports for extra monitors<br />
CD/DVD drive<br />
<br />
Plus it is the Microsoft Signature Edition so no bloatware. They kept that promise. There was nothing for me to uninstall. Came from MS store with free shipping. Odd thing is they shipping in just the Asus box - no extra padding at all. At least we had to sign for it as it was very obvious what was in the box so you would not want it just sitting on your front steps. At least the Asus box is nice and thick and was not damaged at all.<br />
<br />
Machine boots in 10 seconds. Runs like a champ, is nice and quiet. Keyboard has good travel and 3 levels of back lighting. Screen is semi-gloss and looks good in everything but direct sunlight. I really like the touchscreen as well. When I do Android work I can pop-up the emulator and treat it like a real device when it comes to scrolling, tapping, long press and swiping. It does not support pinch zoom. The PC does for Windows but does not for the emulator. It is in Google's list to address.<br />
<br />
Using the touch screen is nature in Windows as well. We are all pretty used to using a touch device such as a tablet or a phone so you want to do it on your computer screen as well. Tapping a button or scrolling works great.<br />
<br />
I have had no issues with wireless internet connectivity. It also has standard port to hook right in to a wired connection as well.<br />
<br />
As stated boot times are quick, starting any program off the SSD is very fast. Android compile speeds with the source code, SDK and tools off the SSD are are top notch in speed as well.<br />
<br />
What is wrong with it?<br />
<br />
1T HDD is only 5,400 RPM. Wish it was 7,200 but since I can fit all the stuff I want to access quickly I can fit onto the 256GB SDD. I put music, videos, images, utilities, etc. out on the HDD.<br />
<br />
It is heavy but I don't plan to haul it all over the place. It may go to an offsite meeting from time to time but that is about it. I would not recommend this for a college student to haul about. The power brick is just that - a brick. Needs to be big to power this beast.<br />
<br />
The trackpad itself is responsive but the buttons seems to miss clicks at times. Still trying to get used to that. Track pad is nice and big so you don't have to lift and scroll over and over. Responds to multiple finger scrolling and the like as well. It does show finger prints as well but you tend to slide around so they kind of smear on to the pad.<br />
<br />
While the back lighting is good the font used on the keys is a bit much on the Star Trek / gaming side. The font could be more readable. I touch type quickly so I generally and not looking at the font but it is still weird.<br />
<br />
Sound is just OK, on the muddy side and full volume is way too low. You can tweak some of it with the Asus Sonic Sound Studio control panel. Headphone volume is great. Good thing there are separate settings for that vs. speakers so you can set speakers at full volume and headphones at 50%. I was able to get headphones to sound respectable. Still need to work on the speaker side of things.<br />
<br />
I know new Pascal based machines are coming out. They cost a whole lot more and were very game oriented. I needed something I could game on but was mainly for Android development. This machine hit all the big items on my list. I am very happy with the purchase. There is space under a one screw to remove panel to add another SSD if I need it. I have a feeling the current configuration will last a pretty long time.<br />
<br />
At first I was trying to figure out how to right click on the screen. I thought maybe two fingers or quick taps. Turns out you long press then a rectangle will start to grow from where you finger is then a release will show the right mouse click menu. Windows realizes you use a finger so there is more spacing between the menu items as well for easier tap zones. Would not game doing this but it works fine for doing user interface based interactions.<br />
<br />
No regrets on this machine. Doing everything I ask of it. I was not expecting perfect and it is not but it hits the majority of the areas I need, just missing some minor things but none of those things were on my must must have so I don't feel I settled.<br />
<br />
Compared to the new stuff coming out this is a B for gamers, it is a A for developers.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-5211067121985673952016-05-22T14:06:00.001-05:002016-05-22T14:06:54.458-05:00Google I/O makes owning and Android device depressingI watched a number of the Google I/O 2016 videos on YouTube. Tons of new stuff coming our way which is great. I am happy that Google is innovating in a lot of areas. So why is it depressing? Because I have a Samsung Note 4 phone that is still back on 5.1.1. My wife's Note 2 is on 4.4. Only 7.5% are on Marshmallow.<br />
<br />
It is great that Google broke out some of the features like the new constraints based layout manager to support libraries but a lot of the other features I can't use because Samsung + TMobile has not updated. It sucks to be stuck in the past.<br />
<br />
My next phone will be a Nexus phone so I can get updates close to the speed that iOS users are accustomed to getting. I know I can't code against all of them but at least I can enjoy them and I can test things like multi window support on my devices.<br />
<br />
I have to be honest with myself. The things that Samsung added such as the stylus and multi window I don't use that often. Not all apps support them. I am happy to see Google adding that as a base feature to Android especially for tablets when I think it will be very helpful. I can give up the stylus for a Nexus phone. I like the large size of the Note but there are similar Nexus devices out there.<br />
<br />
This really is an area I totally wish Android was more iOS like. New version of the OS and pretty much everyone can get it nearly right away. Yes, at some point you have to cut off devices that are older than 4 or so years. Otherwise here you go, enjoy all the new features. Instead I sit here not even enjoying the stuff they talked about two years ago.<br />
<br />
At least my tablet has Marshmallow on it so I can test there.<br />
<br />
Samsung, you do some cool stuff but then you do some real a-hole stuff so I have to move on.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-21944936300136394012016-02-22T12:05:00.001-06:002016-02-22T12:05:13.932-06:00So far Windows 10 has been a big thorn in my sideI started with my main PC - an i5 with 16g of RAM. Hand built box with a newer nVidia graphics card. I upgraded from Windows 7 to Windows 10. Had to find one off drivers from my sound card but got that working.<br />
<br />
Then I made the mistake of using the MS website to order an Xbox One for my sons for Christmas. MS switched my login to use that account. I did NOT want that to happen. Then my network card got confused and it could not see the internet so I could not log in. After many hours of screwing around with way too many tools I finally was able to create a different admin account, get the network working again and then log back into my main account with the MS website password. I was hating Windows 10 at this point and I wasted way too many hours.<br />
<br />
I got my sons machine, that was on Windows 8.1, upgraded next. Another pain. Everything was working until yesterday. This is also a hand built machine. Now I just get a black screen with the basic white mouse cursor running about. Tried for a couple of hours yesterday to get that resolved but no such luck. Might have to reinstall I don't know.<br />
<br />
My wife's parents installed Windows 10 on their box and then lost the ability to talk to their Android phone and Kodak camera. This is a refurbished eMachine from Microcenter. I was able to get things back up and running by doing some manual driver installs. Still don't trust everything but it is working for now. Also a Windows 7 upgrade that was an upgrade from Vista. The main menu was broken on this machine until I uninstalled drop box and reinstalled it. Took hours to figure that out as well.<br />
<br />
Looked up my wife's Lenovo laptop and it is recommended that you DO NOT upgrade this box as you will lose sound. They just are not going to do drivers for it. Since I have had all the other issues really wanted to skip this box too.<br />
<br />
A friend upgraded her newer Lenovo laptop to Windows 10 and then brought it to me as it was all screwed up. I upgraded every thing I could on the machine, mainly Lenovo drivers, and got it back in shape. Since then it has been working OK for her, fingers crossed.<br />
<br />
Not doing either of my son's laptops. Older laptops and he attends a virtual school so having them down would be a huge hassle. They will be left alone until they die. Both on Windows 7 at this time and they run just fine using that.<br />
<br />
Finally I am skipping the family file / print server. Windows 7 on another refurbished eMachine. Just as stated it is file / printer server that does M-W-F backups to an external HD. Everyone stores everything out there so you can use any machine in the house to get to things. It also needs to be running at all times. Not going to risk Win 10 screwing that up.<br />
<br />
I just can't recommend Win 10 as an existing machine upgrade. Yes, once I got it going on my main PC it has been fine. I do think MS is being way to snoopy with this update as well. I disabled all the call home stuff I could on all the machines that I did upgrade. But I keep running in to new issues. Have to get my son's machine out of black screen of cursor only mode. Did the boot from physical media and tried to get it to repair things but no luck there yet even. Lots of posts about this issue, some get it fixed, others do not.<br />
<br />
You will have something broken. It will take you hours to figure it out. You will cuss and scream at all of this. Sure Win 10 is fine on a new machine but upgrading has been very painful and I now I have a machine that is down again. Plan on cussing at it tonight some more trying to get it back to life. I will not risk any more machines in my house and I have warned all family and close friends to not update and just to ride out Windows 7 until they get a new machine.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-9035697460185163572016-02-05T08:44:00.001-06:002016-02-05T08:44:32.566-06:00Headhunters, can't live without them, can't get them to stop asking inane questionsI get contacted by head hunters / recruiters / talent hunters at least once a week. A lot of it is blanket emails from LinkedIn but some from local folks I have worked with in the past. I am not looking for a job so this is all cold calls hoping like heck you want to change positions.<br />
<br />
Head hunters need to clean up how they perform cold calls. Yes, some time in the past I have done Basic, Delphi, Clipper, C/C++, C# and other languages but I have not really touched them in the past 5 years. It is silly to approach me for a job where the company is looking for a Delphi programmer. I doubt they want to talk to someone who used it for a few months 7 years ago. Keyword searches without also using a timeframe context is a waste of everyones time.<br />
<br />
Quotas are stupid. I work remote so I don't drive any place during the day. I can tell a head hunter that I am not looking for a job but they want to take me out for coffee anyway. Why? They can write it off and hit some "talked to a developer quota" they have. Why would I take time off work to do that? When I was looking I did have lunch with a few head hunters so I could give them a better idea of what I was looking for and to get a feel for the current job market.<br />
<br />
When I was looking to change jobs I had one head hunter try to send me to interviews to up her count. She did not care about me or the company that was looking to hire. I was told the name of the company and I knew it totally underpaid for the area. They have been advertising for senior level C# developers for same salary for years. Second it was C# which I had not touched in years and I specifically told her I was only interested in mobile work. She was getting mad at me for not wasting my time - it would have been a $35k a year pay cut in a language I was not interested in doing. She said it would give me interview practice. What? Totally waste my time and their time but she got a notch in some ledger for trying. I told her the other company would be mad at her for even sending me over. They probably pull 2 or 3 people out of important work to talk to me. She called me back a few days later to apologize but I will never work with her or the firm she represents ever again.<br />
<br />
It may sound cool to get approached by five head hunters in a week. Looking at it logically you can easily see a pattern. There is one job opening and they are all trying to fill it. A business in the area first attempted to fill it using internal HR staff. When that did not work they reached out to a few trusted firms. Once those did not pan out they shot gunned the head hunter pool. Now they all want to fill this position. Do you know why it is open? Because the hiring company has a bad reputation in town. Either they under pay or they have a less than stellar work environment.<br />
<br />
I have been called to fill a position I previously had. Listed right on my resume and on LinkedIn. I left for a good reason and don't want to go back. Not that I have burned a bridge, just would not work there again. When they call they give me some generic "local company in the financial industry" and I say "Is it Company X" and they fully admit it is. Tell them I worked there before and I know the person who left leaving this vacancy. They tell me management changed since I left and I inform them yes, it changed for the worse as my buddy who just left filled me in on the current set of issues.<br />
<br />
It is pretty easy to get a bad reputation in town as it really is a small developer community which is even smaller when you are dealing with mobile developers. Once you have a bad name you are not going to get primo talent again. I let the head hunters know they are going to need to reach outside the area to find someone.<br />
<br />
Which brings us to another point. If you get called about an out of town position guess what happened? They have scared off all the local talent so they are reaching farther out. Since I have been watching this pattern locally I would be really scared to take a job in another area of the country. Company either underpays and you don't understand the local economy to know that or they have a crappy environment. Either way you need to run away from them. If you are a novice developer just looking to get into the business it might not be a bad idea to get some experience under you belt but if you have experience it probably is not a good idea.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-3290535299295494052016-01-20T13:53:00.001-06:002016-01-20T13:53:41.527-06:00Hey, I want to be an Android programmer. Tell me what to do.How many times have you seen a post on various forums about someone wanting to be an Android programmer? Is there a simple answer? Of course not, programming is not easy and there are piles of things you end up doing during any given day.<br />
<br />
Wait a minute there! Isn't all I have to do is learn Java and some Android libraries? Oh, how we all wish but there is a lot more going on and that is just the start. Yes, you need to learn Java (or Kotlin) and you need to learn about the SDK as well but there is a ton more.<br />
<br />
Today it hit me I had been in the following in just one day:<br />
<br />
<ol>
<li>Java writing the main app code</li>
<li>Kotlin working on a utility program to convert iOS plist to Android format</li>
<li>Groovy because I was editing the gradle build scripts</li>
<li>Bash as I updated my Java version and needed to change my .profile </li>
<li>Various Linux terminal commands</li>
<li>Various Git commands on command line and in Source Tree</li>
<li>Vector Graphics as I was working on a new image I needed</li>
<li>XML for the Android layout manager, string tables and color tables</li>
<li>PNG images for new icons</li>
<li>REST calls</li>
<li>JSON parsing for REST call responses</li>
<li>Sublime text editor creating and running macros against text files</li>
<li>File manipulation in Finder</li>
<li>Looking at ObjC in Xcode that I am converting to Android</li>
<li>Using IntelliJ, Android Studio and Xcode</li>
</ol>
<br />
It is not just learning Java and an API. I could not get Adobe Illustrator to do exactly what I wanted to I directly edited the SVG file. How many languages and file formats have I been in today already? Piles of them and I was able to quickly do the list above and I am sure I missed stuff.<br />
<br />
Obviously Java, Kotlin and Groovy have a similar syntax so it is not like I am switching from assembler to JavaScript mentally but there are differences so you do have to perform a mental switch.<br />
<br />
I don't mess with graphics every day but we have been setting up a number of build flavors this week so I have been doing a lot of graphics work along with "normal" programming. Honestly there is no such thing as normal. I shift around all the time. I decide to write the utilities in Kotlin as something new to learn, it was not required by my job. Glad I did, gives me a better appreciation of the language. Really want v1 to move out of beta before I use it for my Android apps.<br />
<br />
Developers have to understand more than just the language they are using. You end up using a lot of tools like Git, Paint.NET, Adobe Illustrator, Adobe Photoshop, different IDEs, text editors and various utilities. Plus you get to keep the OS on your machine updated along with IDE, SDK, Language versions and tools.<br />
<br />
Never know when the boss will need your help on a spreadsheet, document or power point as well. You have to be able to run at least a minimal feature set in a ton of tools just to keep up with life as a developer.<br />
<br />
I am unsure how a new developer even gets started. I have amassed a large quantity of knowledge over the years. I can apply that to Kotlin when I experimented with it this week. I already knew the IDE, the .plist file format, XML, how to use collections, etc. I was picking up a new syntax but when you start from scratch you are tossed into a tank of sharks. The only way is to start small. Just work on one concept then move on. If you try to do an entire game or program with multiple screens you will go nuts before you get very far.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-39568547763160051422015-05-14T15:39:00.001-05:002015-05-14T15:39:39.655-05:00I ripped out RestKit and replaced it NSURLSession and MantleWhen I started at my current job I knew I would be doing a lot of REST interaction with the server. I decided to use RestKit as I had seen it mentioned a number of times in various developer forums.<br />
<br />
It worked for some time but I finally hit the breaking point and ripped it all out changing 265 to convert them to NSURLSession and Mantle. Was I insane? Pretty much as in the end it did not solve the problem I was originally attempting to address but I am happy with the change.<br />
<br />
First off Mantle makes it much easier and cleaner to handle JSON. It is not as easy as GSON on the Android side but it is not too bad. That was a lot of my file conversions and I do find it easier to add a new JSON object due to a new REST call to the server. The one downfall is each of your JSON receiving objects has to be derived from a Mantle class. Objective C does not support multiple inheritance which could make this a very limiting factor for you.<br />
<br />
The other area I am not too happy about with Mantle is it handles converting NSDictionary and NSArray to JSON. That means I get a big JSON string from REST and then I use NSJSONSerialization to convert it into a NSDictionary and then convert that via Mantle to Objective C objects. Waste of memory and processing to double convert things. Good thing the JSON data is reasonably small.<br />
<br />
The other side was getting rid of RestKit calls. This helped the code a lot. I had one REST call manager class that tried to handle all the server calls with delegate callbacks. Now all the calls are inline where they are called in the code and that code has block processing to handle the results. This lets you see what is going on easier. Plus if it is a PUT call I only have to reference PUT in one line of code whereas I had to do that in three places when using RestKit. Setting up each call in RestKit took a boatload of error prone boilerplate code. I sure as heck don't miss that.<br />
<br />
So why not go with AFNetworking? Seems to also be popular but in the end even AFNetworking is using NSURLSession in the end. Apple seems to put together a decent networking package learning from others. One less pod to include in my build and hopefully using the official Apple networking that appeared in iOS 7 will keep me in the safe zone.<br />
<br />
On the Android side I am using Volley and GSON, both from Google but not part of the base Android SDK. Volley is very similar to NSURLSession which is good. GSON is easier to work with than Mantle in there is less boilerplate code. If your variable names match the property names in the JSON you get from the server there really is no boilerplate at all. If they don't match a simple annotation gets them to sync up.<br />
<br />
So what was the original issue I was attempting to fix? I want to have two type of NSURLSessions going in the code, one to do the normal user interaction processing - they tap something, I make a server request, I get server result and I show new data in the current view or in a new view. The second was to be a background session for uploading video via Amazon Web Services.<br />
<br />
I am using AWS but I am using the straight API from them. Yes, there is sample upload in the background code out there and it works when you don't have the other NSURLSession doing other work which really stinks. I want the user to be able to start a video upload and have it run in the background until complete even if they leave my app or turn off the phone screen. Works like a champ on the Android side where I set up a very basic service.<br />
<br />
I realize Apple really does not want you do to anything in the background. They trust no one. They do have a new thing that lets you get maybe 10 minutes of time to do some background work. That is one of the things NSURLSession is set to allow. But I just can't get it to work. It will start, send up some % of the video then restart at 0% and do that over and over again. On the simulator, which does not run like a real device, it can get the whole video uploaded never triggering the restart you see on the iPhone or iPad. I have posted a message on Stack Overflow describing this issue but no answers.<br />
<br />
I really wish Amazon would handle this for you in their API. Seems like background uploading would be a really common thing for a programmer to want to do with them. Maybe Apple could handle it in their API as well but I doubt that as they are anti-background as it is.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-50404044239926779042015-03-03T10:27:00.001-06:002015-03-03T10:27:47.164-06:00iOS battling 3rd party toolsI have been battling various items in iOS over that past week and it is getting really frustrating.<br />
<br />
First up I really wanted a dialog with some text entry and a few buttons. They pulled the "custom view" part out post iOS 6 so I found a few GitHub repositories that should solve the problem. First once just did not pan out and the UIView just did not look right. Second one appeared to work OK at first but then it did not play well in iOS 8 in landscape.<br />
<br />
Apple decided to change the way you get back height and width of the screen in iOS 8. Previously you always got height and width as if you were in portrait mode. Now they give it back for the current screen orientation. Huge change for programmers. People had height / width swapping code to handle this and you still have to do that for iOS 7 and older.<br />
<br />
I fixed the code so landscape worked for iOS 8 on the simulator. Once I ran it on a real device things went to crap again. Extra things being painted and the keyboard popping up really screwed things. Lesson learned - iOS really does not like this sort of popup with editing.<br />
<br />
Gut things yet again and go with a UIPopoverController on the iPad and navigation to a UIViewController on the iPhone. Can't say I am super happy with the iPhone version but it works and popping up the keyboard does not screw anything up.<br />
<br />
Next up was the menu. iOS 7 has a bug. If you have too many items in a UIActionSheet on an iPhone you can't tap the top most item if it happens to cover the main navigation area. Works fine on iOS 8 but broken on iOS 7. UIActionSheet expects just a few items.<br />
<br />
So I found a popup menu that allows up to 9 items per screen and you can swipe to scroll and see more. It is call btSimplePopUP. Now I should have known that someone using two menus - btSimplePopUp and btSimplePopUP - in the same directory structure was going to be iffy. The demo screens look nice though. I put in the code and I get the menu to appear but with a black background. What? It is not blurring out my UIViews, just blanking them out. Then I look for known issues and it turns out the control does not work in landscape which is a requirement for me.<br />
<br />
Punt that control. I am now looking at KxMenu which seems to be working in portrait and landscape and takes up a lot less screen space than UIActionSheet. Hopefully it will be the solution.<br />
<br />
Lots of GitHub projects lose support. iOS 8 was a big change and it takes some recoding especially with custom controls due to the changes Apple made. Stinks people don't have the time to keep things updated. Even worse when I waste the time trying to get them to work. I need to start looking at the known issues first. Anytime it does not support landscape I am not going to use it. Hopefully they also list if there is iOS 8 support issues as well.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-26266658082190173962015-01-20T07:12:00.001-06:002015-01-20T07:12:53.460-06:00MacOS has lost its stabilityI do both iOS and Android development thus I have a MacBook Pro has my main development device. I have had one for the last 3 years. Since upgrading to Yosemite it has become the least stable development box I have worked on in a long time.<br />
<br />
I leave the machine on and lock / put it to sleep when I am away from my desk. This may be going to a meeting, going to lunch or home for the evening. When I come back from lunch there is a very good chance, 2 out of 5 days, that the machine has rebooted. This also may happen during the day when I am actively working on the machine but that is pretty rare. The sleep cycle seems to be the main trigger.<br />
<br />
This is an upper end machine with an SSD drive so the reboot does not take too long but it does interrupt my day and it may happen a couple of times a day, when I come in, after lunch and then maybe after a meeting. Yes, all the programs restart but they don't show up in the same position or with the same data showing. Sublime text appears on screen 1 instead of screen 2. Finder does not have the same tabs open. Chrome might be annoyed in some manner. I will not have the tabs in iTerm on the same directories.<br />
<br />
This was never a problem in the past. The MacBook just worked. Now it reboots and has issues with DNS getting lost part way through the day as well. Ping will not find a machine but NSLookup will.<br />
<br />
I also have a Dell PC that is used for my Windows activities running Windows 8.1. I leave Outlook, Hipchat, Sublime Text, Chrome and a few other things running on it as well. I do a lot of my graphics work on that machine because Paint.NET is free and pretty darn full featured. We also use TFS for version control and I do that work on that machine along with anything I need to do in Visual Studio including C#. I don't have a massive love for Windows but at least that machine is only rebooting when it needs to do updates, which does occur too often for an OS, but otherwise it is there ready to go.<br />
<br />
iOS has become less stable as well. I think Apple needs to stagger the releases instead of trying to do MacOS, iOS and iOS hardware release all at the same time. I bet their QA department is hammered during that yearly cycle and it is really starting to show. I love new and exciting things but they need to be stable. Right now Yosemite is not stable and is highly annoying.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-39220019648166621322015-01-13T08:40:00.001-06:002015-01-13T10:59:09.927-06:00Why I have given up on Interface Builder and Story BoardsI just ran into another case where Interface Builder did not allow me to do what I wanted to do and I finally just gave up and pulled everything but the first view controller from the storyboard. This is the story of how I got to this point.<br />
<br />
My first iOS app was one of "finish this". Another developer who was no longer with the company had developed the app. I had the job of finishing the app and converting it to Android. I already knew Java and had written an Android app that was in the store. The iOS version used NIBs as this was back in the iOS 4 timeframe.<br />
<br />
I continued down the NIB path and converted the app to be universal with special code for iPad layouts. There was special cases for landscape vs. portrait on one of the screens as well. Seemed to work OK but it was a fairly straightforward app.<br />
<br />
I worked only on Android apps for a some time before my next position where I did both iOS and Android work again.<br />
<br />
The next iOS app I worked on was written by another developer and he used storyboards. Still using the old style layouts with pixel perfect positioning. I kept the storyboards in place seeing some of the advantages of using them and added the iPad storyboard side of things. I liked how much easier it was to get things going, used segues and like the idea of seeing the program flow in a visual designer. Took quite a bit of web research to understand how it all tied together and a lot of clicking on tabs in IB to find all the secret nooks and crannies where you could set things.<br />
<br />
I did a couple of other apps for the company that I got to write from scratch. I used the new found storyboards for them as well. Sadly none of these apps went to market as they never finished the server side of the work. Lots of pretty apps to demo at sales meetings but they were just demos.<br />
<br />
For my current job I am again getting to write the app from scratch. I am doing the same with the Android side of things. I started out using storyboards and it was time to get into autolayout. Since I have been doing Android work and I have also done a lot of Java desktop work I have a solid understanding of doing layouts that scale.<br />
<br />
I dove into autolayout and found it rather confusing. It appears to me to be written in the land of academia instead of the land of real world programming. One layout to rule them all no matter how you have to force things into it. Very verbose in one code only format and very terse in the other. If you do it in Interface Builder then you just have to know how to do things. Click here, Ctrl + Click here, set up constraints, delete them, set them up again, have them conflict, pull hair. Always something wrong and it get really bad when you have a complex layout. For a company that prides itself in UI and UX I must say IB is not a good reflection of that goal.<br />
<br />
After fighting it and working with other iOS devs over chat I found Masonry and switched to that. Yes, it is code and not WYSIWYG but I could create complex layouts and have them work. I could do different layouts for iPad and iPhone and follow them logically. I still have storyboard layouts but most of them were empty as the code created the real layout. I was just using them for segues and to see program flow. That was until yesterday.<br />
<br />
There I was back in Interface Builder. I just wanted a UITableView to move down one level, to have another UIView as its parent. IB fought me tooth and nail. I could and a UIView to the list but it would not show up under the UIViewController no matter how I dragged and dropped and clicked. I then said screw it and deleted that entire view controller and created a new one where I could re-add the UITableView but then all my segue links broke and all the IBOutlets into the code broke and I would have to do it again for the iPad storyboard and all the work went on and on. Plus Xcode crashed more than once while I was in it doing simple things.<br />
<br />
Storyboards end up sucking pretty quickly. There is not enough screen room to see your iPad layouts. You get to see one scene at a time. Sure you can zoom out but the minute you edit something it zooms back in. Just opening a storyboard seems to trigger Xcode into thinking there was a change. If you look in the XML you will see it changed x = 4.0 to x = 3.999999999 or something just as stupid. Everything I did I had to do twice, once for iPhone and once for iPad. The IDE does not tell you if you forget to wire up a UIView to an IBOutlet. Objective C does not care if you send messages to a nil object. Moving a UIView can screw up the whole layout quickly. You can't see all the constraints in one place, you have to look in each level of the layout to see them and they are terse and unrelated to each other. When you try to Ctrl+Drag a UIView into the code you hardly can see anything else on screen.<br />
<br />
I gave up. IB was fighting me not helping me. I converted all the code to Masonry and I was able to control that layout exactly. I had to move all the segue processing in code as well. It took me all day to get my code back to where it was before but now I am in control of all of it.<br />
<br />
I don't have to do things twice. iPad and iPhone both work from one code base. I may have some if statements in code to tweak layout for iPad but I don't have to double layout it out in a crappy UI editor called IB and I don't have to double connect every UIView to a IBOutlet.<br />
<br />
I can move a control around in my layout by changing a few lines of code instead clicking a bunch of times in IB and having it get pissed and redo other constraints.<br />
<br />
I can name my controls so when I do get log messages about my layout being screwy I know exactly which UILabel it is mad about instead of guessing.<br />
<br />
Another issue that bit me, I fixed, that bit me again and I fixed the right way arose. I needed a second line for the title area on iPhone. iPad has enough horizontal space to not need this. I was using the navigation prompt property which adds a second line of text to the title area. On Android I could use title / subtitle to do same thing but on Android this requires no extra vertical space.<br />
<br />
How did this bite me twice? A number of months ago I wanted to add a UILabel above my UITableView but I could not due to same issues that I just covered, I could not get the UITableView hosted by another UIView. Thus I used the prompt property. It worked OK. After the conversion away from storyboards everything in this UIViewController aligned just fine the first time I displayed it but when I tapped a table row and moved to the detail screen then back to the table screen setting the prompt caused the navigation area to grow and it covered up part of my table. Rotating to landscape and back would fix it. I tried all sorts of relayout, needs display, calculation of offsets etc. and could not get it to work. Why autolayout would not stay in sync is beyond me but I got sick of fighting that.<br />
<br />
Then I remembered what I originally wanted to do - put a UILabel above the UITableView on iPhone only. Now I am in control as I am using Masonry. Put the UILabel in place and changed all code references from prompt = to promptLabel.text = and I have a working layout the way I originally wanted.<br />
<br />
I have no plans use prompt again due to it screwing up layouts and I will not be using storyboards or Interface Builder either. They just are not stable and cause more trouble than they are worth. I also do most of my work in AppCode instead of Xcode as AppCode does a much better job in a lot of areas. Better editor, much better refactoring, GIT actually works properly and it is stable. I have had it crash on me once in the two plus years I have been using it.<br />
<br />
The other added benefit - I can take my code and drop it in another project and it will work. I have no dependencies on copying the layouts twice and having to manually reconnect every single freaking UIView to an IBOutlet. My code is self contained. It lays itself out and knows how to talk to all of its controls.<br />
<br />
Goodbye IB and storyboards. I don't miss you.<br />
<br />MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-49255115402988292842014-08-29T10:15:00.002-05:002014-08-29T10:15:39.701-05:00Switched to autolayout via MasonryI have known for some time that I needed to start using autolayout for my iOS development. My current app is universal so I was doing things twice already in Interface Builder which was getting to be a real pain. Add the control, drag and drop the IBOutlet connections and don't forget to do it on the other side.<br />
<br />
I tried to use autolayout in Interface Builder and finally got my fairly simple login screen to work but I cussed at it the whole time. Move a control, have IB tell you the constraints and form are out of sync, correct it and repeat. If you move a control that was used as a reference anchor for other controls then it got really lost. You end up manually deleting constraints that show up either below the control you are moving or maybe at the root view. Just way to painful and error prone.<br />
<br />
Here is where <a href="https://github.com/Masonry/Masonry">https://github.com/Masonry/Masonry</a> comes into play. I have used a number of layout managers in the past including standard Java layouts, MigLayout for Java and the Android XML layouts. Masonry is similar to each of them in a number of areas.<br />
<br />
A new layout with about 35 controls was the tipping point. No way I was going to do that after all the venom I spewed at IB doing the login view with only 7 controls. I got the new layout working pretty quickly in Masonry then I went back and ripped the login from IB and did it in Masonry where I can easily see the exact constraints and view relationships.<br />
<div>
<br /></div>
I attempting to use the Apple flavor of programmatically doing autolayout but I found it to be very verbose and nearly as confusing as IB. The other shorter syntax messed with my mind also. Masonry seemed to go right down the middle.<br />
<br />
Not a huge fan of checking in the code for iPhone vs. iPad but for a universal app where you want special layouts that is what you get to do. Not sure what will happen when the new iPhone 6 comes into play.<br />
<br />
I am now skipping story boards and all their headaches and just doing my layouts in code. This also means is a new developer was to come on board we would not be walking on top of each other when we change a layout which stinks with storyboards and version control. That developer would get to learn Masonry but it is reasonable straight forward. I still run into some odd layout issues that send me scrambling to stack overflow but in general it has been pretty smooth.<br />
<br />
UIScrollView gave me the most fun but once I figured out how to anchor the scroll view to the main view then anchor child views of the scroll view to the scroll view it all worked out.<br />
<br />
The error messages given by autolayout are not super helpful. Some trial and error is involved but I don't run into errors very often anymore.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0tag:blogger.com,1999:blog-2188951568343415255.post-45218691692883780702014-07-14T18:14:00.003-05:002014-07-14T18:14:37.810-05:00When do you learn a new library?When do you take the time to learn a new library? I decided now was as good a time as any since I was at a new job and working on a new application. In the past I have used straight JSON parsing and hand written HTTP code. This time I decide to see what RestKit had to offer for both areas and I am happy I did that.<br />
<br />
It can be very hard to retrofit a new library into old code. The design most likely does not follow the new pattern. No one wants to start from scratch when an existing product is already working. Kind of a shame because a lot of the time doing that can really make things work a lot better and make it easier to catch odd exceptions.<br />
<br />
Per usual I got the Android side up and running pretty quickly. I did use the GSON library, which I have used in the past, but I used it in a deeper way. I set up the objects with the correct annotations and I let the library create my objects from the HTML body of the response. Worked like a champ. I implemented loaders to pull in the data and images for everything to happen on a background thread.<br />
<br />
Next up was the iOS version. I found a lot of RestKit information on the web so I figured I would give it a shot. Not only does it handle the HTML / JSON request / responses but it also deals with JSON to object mapping. It took a bit more work to get that going though. You have to return object mappings instead of doing simple annotations. Once I had it figured out it worked very well. Some trial and error as I made the request over and over to the server to see what else I screwed up in the mapping. The JSON objects I am parsing go 6 levels deep. I did not write the server side so I am not in control of that aspect.<br />
<br />
The image side was a different story at least when it comes to requesting a lot of images via queue in a background thread. There is a lot of documentation about the older .10 version of RestKit but less for the newer .20 code base. I fumbled around with things for a bit then found the SDWebImage library which did exactly what I needed in very few lines of code.<br />
<br />
I am using CocoaPods for all my iOS work along with AppCode for the IDE. Yes, I have to switch back to Xcode from time to time as I can't find ways of doing things such as adding a Font to the project. This is not a super straight forward thing in Xcode either. I really want AppCode to do everything. I have been doing my Storyboard work in AppCode. Took a little bit of time to figure out where to drag from to get the IBOutlet connections to work. Xcode is confusing in this area too, nothing leads you down the path, you need to know to hold down the right keys and drag things and drop them on the right area. They improved this with Xcode 5 where you drop directly in the code but boy does the screen get cluttered when you try and have an iPad Storyboard open with code too.<br />
<br />
Working with iPad Storyboards is a pain in both products. The screens are big and even though I am running the IDE on a 24" monitor there still is not enough space. I guess I need to have the IDE span both of my monitors as anytime you need to set up a segue between two screens you just don't have the space to do it. Even running the simulator on a 24" monitor for an iPad Retina at 50% leaves scrollbars in place. This outright sucks. I use GenyMotion for my Android work and I am able to easily scale that window to fit on screen.MKevin3http://www.blogger.com/profile/14017088108968329074noreply@blogger.com0