Monday, September 22, 2014

[Updated] Seagate External HDD NTFS Driver for Mac

This is a simplified post detailing how to go about using Seagate External HDD on Mac.

  1. The Seagate External HDD by default formatted as NTFS. Mac has flaky support to read and write to NTFS. Sometimes you will be able to write, otherwise it will open the HDD in read-only mode. In worst circumstances it will not even detect your HDD. Don't Panic.
  2. If you are able to read your Seagate HDD in read-only mode, check for driver inside Vendor folder and hope along with all the goodies you have the NTFS Driver. Don't confuse goodies with driver. After installing all the relevant apps inside Vendor, restart your Mac and hope everything works flawlessly. If you are still facing issues continue following the instructions.
  3. If the above solution didn't work for your or if you are not even able to detect your HDD, download the Paragon NTFS Driver for Mac from the Seagate website using this link. Accept the EULA, and download the dmg driver file. Install and restart your Mac, check you are able to detect your HDD and read/write without any issues.
These are the only tricks up my sleeve, if it still didn't work for you, hard luck :(. If this post was helpful, kindly '+1' this and leave a comment :).

Android Continuous Long Click Listener

This is about implementing a UI Pattern very common for mobile applications. You have a button which increments the value if you do a simple click on a button. If you long press instead of click, it increments the value in chunks rather than single units. These behaviours can be implemented using standard Android library event listeners like View.OnClickListener and View.OnLongClickListener.

For my app, I was looking for implementation where you keep the button pressed and it continuously keeps updating the value in chunks. Sadly, View.OnLongClickListener doesn't have any such support, so I decided to make a custom listener for this behaviour. You can view the final implementation here -


Some notes on the implementation of this listener -
  1. To support continuous long click listener, I am attaching 2 listeners to the view object. View.OnLongClickListener and View.OnTouchListener
  2. View.OnLongClickListener kicks in when it first detects a long click by user. After executing the default behaviour, it adds a delayed message to a Handler to execute the same code. This way, after a stipulated time the same code kicks in and increments the value again and thus simulating the required behaviour for continuous long click.
  3. View.OnTouchListener is used to detect a MotionEvent.ACTION_UP event, where the user disengages from the screen. On detecting it, any pending messages in the Handler are cleared thus finishing the event.
  4. As an add-on, I stimulate a haptic feedback every time the code is run to give user feedback about the long click action being kicked in.
The code for the above sample can be found on github here -> https://github.com/anagri/AndroidLearnings

The gist of listener implementation is below ->

Thursday, September 18, 2014

Enabling Developer Options in Xiaomi Redmi and Mi3 for Android Development and USB Debugging

I hope many of us in India were able to grab the Xiaomi Mi3 or Redmi throught the flash sale on Flipkart. If you haven't, I would highly recommend to get this value for money phone.

Anyways, for me, the primary purpose of buying this phone was to use it for Android App development. To my surprise, I couldn't find the USB Debugging option in the Settings. I was utterly confused and so I did the obvious - Googled it.

It turns out, the Developer Options are hidden by default in the MIUI - the custom UI that comes installed on Xiaomi phones. And to show these hidden options is like finding an easter egg.

To enable the developer options follow the steps as below -
  1. Open Settings -> General Settings -> About Phone (Screenshot 1)
  2. Tap on the item "Android version" (Screenshot 2). As you tap on it, you will see a toast message saying "x more clicks from Developer Options"
  3. As you keep tapping, finally you will see a toast message confirming "You are now a developer" (Screenshot 3)
  4. Thats it. To confirm the Developer options are enabled, go back to General Settings and find Developer options under System settings group (Screenshot 4)
This phone have host of Developer options ranging from the basic of keeping phone awake to doing some basic profiling. I haven't checked out all of them yet, but hope to do so soon. Happy coding.

Screenshot #1 Screenshot #2 Screenshot #3 Screenshot #4