Friday, August 27, 2010

Closing an activity by touching outside

I have been working on an application that I want to close an Activity when the user touches outside the activity. Like how you can set the setCanceledOnTouchOutside(boolean cancel) in the android.app.Dialog. The activity I want to close is themed like a dialog so there is an area around the activity that is not “active”.

I was able to achieve the desired effect by overriding the activity’s onTouchEvent(MotionEvent event). This method is called when a screen touch event is not handled by any views.

@Override
public boolean onTouchEvent ( MotionEvent event ) {
// I only care if the event is an UP action
if ( event.getAction () == MotionEvent.ACTION_UP ) {
// create a rect for storing the window rect
Rect r = new Rect ( 0, 0, 0, 0 );
// retrieve the windows rect
this.getWindow ().getDecorView ().getHitRect ( r );
// check if the event position is inside the window rect
boolean intersects = r.contains ( (int) event.getX (), (int) event.getY () );
// if the event is not inside then we can close the activity
if ( !intersects ) {
// close the activity
this.finish ();
// notify that we consumed this event
return true;
}
}
// let the system handle the event
return super.onTouchEvent ( event );
}

Now with that code in place, if the user touches anywhere outside of the dialog style activity, it will close.


Monday, August 23, 2010

SMS Backup

screenshot SMS Backup was always one of the first applications I had to install on my device if I had to wipe it clean. SMS Backup is released under the Apache License, Version 2.0 and developed by Christoph Studer. Development has pretty much been stale on this application for the past year.

That is where SMS Backup+ comes in. It is an improved version of SMS Backup, also released under the Apache License, Version 2.0 and developed by Jan Berkel. Some of the main differences are:

  • XOAuth support – Uses XOAuth to authenticate with Gmail, instead of you supplying your username and password
  • Faster – Does not base64 encode the emails before transferring
  • IMAP support – Doesn’t just work with Gmail (but defaults to Gmail), it works with any IMAP server
  • Restore – You can transfer sms messages back from email to the device.
  • MMS Not Yet Supported, but planned

This is one of the applications I like to place in the Ron Popeil category, because you can “set it, and forget it”.

You can install from the Android Market for free:

Sunday, August 22, 2010

Droid Explorer 0.8.7.2

explorer A new release of Droid Explorer was published early today. It fixes the big issue with the server not being able to start. It also has some little fixes that wont even be noticed by most people. For example the extended glass area now doesn’t cause the window to move in an unexpected ways.

I will now be starting to work heavily on the 0.9.x branch. This will open Droid Explorer to many more devices beyond the rooted with busybox devices.

If you have any issues with 0.8.7.2 please report them on the droid explorer project issue tracker so they can be addressed.

Downloads

Application DroidExplorer.0.8.7.2.x86.Setup – 14974K
Application DroidExplorer.0.8.7.2.x64.Setup – 15142K
Application DroidExplorer.0.8.7.2.x86.Standalone – 32911K
Application DroidExplorer.0.8.7.2.x64.Standalone - 33078K

Wednesday, August 18, 2010

Droid Explorer in the top 10!

logo-home

Droid Explorer is, as of the time I am writing this, the #9 most downloaded project on CodePlex. I think this is awesome and want to thank everyone that is using Droid Explorer.

I have been hard at work fixing the issue with the Droid Explorer Service. This is the service that identifies when a device is connected to the PC and shows the device in Explorer. I will have the fix in place by the end of the week and published.

I have also been working the Droid Explorer branch that will become the 0.9.x release. This will be the first version that will support non-rooted devices. The only requirement is that the device can be seen via ADB. All functionality may not be initially available to non-rooted devices, especially in the first versions of the 0.9.x releases. I will be refactoring more and more of the code to stop using custom communication via adb.exe and use the same communication methods that the DDMS uses. This will be accomplished by using MAD Bee.

I am also shooting for an update mechanism being built in to Droid Explorer in the 0.9.x releases. It is going to be a framework that will use an Atom feed to get available updates. It will allow multiple update locations, to allow plugins to specify their own update feed source. Updates can define requirements, minimum/maximum version, and how to “install” the updates. But that is a bit off from being incorporated, it may not make it in until a few releases in to the 0.9.x releases.

Tuesday, August 10, 2010

Notepad2 Theme

xmlfileI love Notepad2. It is the “basic” text editor that should ship in Windows. It is one of the first things I download on a new system, I replace notepad with it, then I add the context menu to open any file in notepad2. I have recently moved to a dark color theme for all my text editors and base them all off the Coding Instinct Visual Studio color scheme. Here is a settings file for Notepad2 that is based on the Coding Instinct Visual Studio color scheme.

I have changed all the supported languages in the configuration, but I have not tested them all. Some may not be 100% correct, or there may be a color that just doesn’t look right on the dark background.

To import the theme follow the following steps:

  • Download the theme file
  • Open Notepad2
  • Press Ctrl+F12, or click View –> Customize Schemes
  • Click on Import
  • Select the downloaded theme file

Fixed link to the download. Seems like skydrive changed the link on me.

Closing an activity by touching outside

I have been working on an application that I want to close an Activity when the user touches outside the activity. Like how you can set the setCanceledOnTouchOutside(boolean cancel) in the android.app.Dialog. The activity I want to close is themed like a dialog so there is an area around the activity that is not “active”.

I was able to achieve the desired effect by overriding the activity’s onTouchEvent(MotionEvent event). This method is called when a screen touch event is not handled by any views.

@Override
public boolean onTouchEvent ( MotionEvent event ) {
// I only care if the event is an UP action
if ( event.getAction () == MotionEvent.ACTION_UP ) {
// create a rect for storing the window rect
Rect r = new Rect ( 0, 0, 0, 0 );
// retrieve the windows rect
this.getWindow ().getDecorView ().getHitRect ( r );
// check if the event position is inside the window rect
boolean intersects = r.contains ( (int) event.getX (), (int) event.getY () );
// if the event is not inside then we can close the activity
if ( !intersects ) {
// close the activity
this.finish ();
// notify that we consumed this event
return true;
}
}
// let the system handle the event
return super.onTouchEvent ( event );
}

Now with that code in place, if the user touches anywhere outside of the dialog style activity, it will close.


SMS Backup

screenshot SMS Backup was always one of the first applications I had to install on my device if I had to wipe it clean. SMS Backup is released under the Apache License, Version 2.0 and developed by Christoph Studer. Development has pretty much been stale on this application for the past year.

That is where SMS Backup+ comes in. It is an improved version of SMS Backup, also released under the Apache License, Version 2.0 and developed by Jan Berkel. Some of the main differences are:

  • XOAuth support – Uses XOAuth to authenticate with Gmail, instead of you supplying your username and password
  • Faster – Does not base64 encode the emails before transferring
  • IMAP support – Doesn’t just work with Gmail (but defaults to Gmail), it works with any IMAP server
  • Restore – You can transfer sms messages back from email to the device.
  • MMS Not Yet Supported, but planned

This is one of the applications I like to place in the Ron Popeil category, because you can “set it, and forget it”.

You can install from the Android Market for free:

Droid Explorer 0.8.7.2

explorer A new release of Droid Explorer was published early today. It fixes the big issue with the server not being able to start. It also has some little fixes that wont even be noticed by most people. For example the extended glass area now doesn’t cause the window to move in an unexpected ways.

I will now be starting to work heavily on the 0.9.x branch. This will open Droid Explorer to many more devices beyond the rooted with busybox devices.

If you have any issues with 0.8.7.2 please report them on the droid explorer project issue tracker so they can be addressed.

Downloads

Application DroidExplorer.0.8.7.2.x86.Setup – 14974K
Application DroidExplorer.0.8.7.2.x64.Setup – 15142K
Application DroidExplorer.0.8.7.2.x86.Standalone – 32911K
Application DroidExplorer.0.8.7.2.x64.Standalone - 33078K

Droid Explorer in the top 10!

logo-home

Droid Explorer is, as of the time I am writing this, the #9 most downloaded project on CodePlex. I think this is awesome and want to thank everyone that is using Droid Explorer.

I have been hard at work fixing the issue with the Droid Explorer Service. This is the service that identifies when a device is connected to the PC and shows the device in Explorer. I will have the fix in place by the end of the week and published.

I have also been working the Droid Explorer branch that will become the 0.9.x release. This will be the first version that will support non-rooted devices. The only requirement is that the device can be seen via ADB. All functionality may not be initially available to non-rooted devices, especially in the first versions of the 0.9.x releases. I will be refactoring more and more of the code to stop using custom communication via adb.exe and use the same communication methods that the DDMS uses. This will be accomplished by using MAD Bee.

I am also shooting for an update mechanism being built in to Droid Explorer in the 0.9.x releases. It is going to be a framework that will use an Atom feed to get available updates. It will allow multiple update locations, to allow plugins to specify their own update feed source. Updates can define requirements, minimum/maximum version, and how to “install” the updates. But that is a bit off from being incorporated, it may not make it in until a few releases in to the 0.9.x releases.

Notepad2 Theme

xmlfileI love Notepad2. It is the “basic” text editor that should ship in Windows. It is one of the first things I download on a new system, I replace notepad with it, then I add the context menu to open any file in notepad2. I have recently moved to a dark color theme for all my text editors and base them all off the Coding Instinct Visual Studio color scheme. Here is a settings file for Notepad2 that is based on the Coding Instinct Visual Studio color scheme.

I have changed all the supported languages in the configuration, but I have not tested them all. Some may not be 100% correct, or there may be a color that just doesn’t look right on the dark background.

To import the theme follow the following steps:

  • Download the theme file
  • Open Notepad2
  • Press Ctrl+F12, or click View –> Customize Schemes
  • Click on Import
  • Select the downloaded theme file

Fixed link to the download. Seems like skydrive changed the link on me.