zer0bandwidth.net

zer0bandwidth.net Android Library

GitHub JavaDoc Test Coverage Google Plus

The Android Library is a collection of classes that have been useful in our various projects, as well as the other projects to which we contribute. They are provided as-is for free use under the MIT license.

In general, for features that interact with Android activities, the library provides implementations for both the modern Activity class, and the AppCompatActivity from the Android Support Library.

For more information about standards and practices used in the library, see Coding Conventions.

Application Features (net.zer0bandwidth.android.lib.app)
This package extends features of the android.app package. The AppUtils class provides methods that retrieve resources and information about the app itself, including the app's name and version, and whether the locale's text is right-to-left. The class also provides methods to initialize a standard back button for an activity.
Content Features (net.zer0bandwidth.android.lib.content)
This package extends features of the android.content package. The IntentUtils class provides standard methods to discover intent actions and create intents that are bound to specific classes. PreferencePortal provides an easier functional grammar for dealing with the app's preferences, and can marshal integer preferences as strings, to work around occasional strangeness with Android's handling of integer-value permissions.
Database Functions (net.zer0bandwidth.android.lib.database)

This package provides classes that allow easier access to SQLite databases. The SQLitePortal extends SQLiteOpenHelper and manages a persistent connection to an underlying SQLiteDatabase instance. The QueryBuilder and its related subclasses provide an intuitive grammar for constructing SQLite statements, so that your code doesn't have to be cluttered with a bunch of SQLiteDatabase invocations where half the parameters are null.

In version 0.1.4, the library includes the SQLiteAssetPortal, which allows definition of read-only databases whose contents are obtained from assets.

Also in 0.1.4, and greatly expanded in 0.1.5, is the SQLiteHouse, which can automatically parse and marshal data classes that are decorated with special annotations which make them usable as a database schema. This framework greatly simplifies the creation of database classes, and allows the classes that contain the data from each table row to also define the tables themselves. Read the JavaDoc for the main SQLiteHouse class for more detailed information about how this framework is used.

NONSENSE! (net.zer0bandwidth.android.lib.nonsense)

This package provides specification of a NonsenseGenerator interface for classes which generate structured, randomized text.

The first and canonical implementation of this interface is the NonsenseBuilder, which randomly assembles grammatically-correct sentences from lists of words categorized by part of speech. If you are interested in contributing to the library of words used by NonsenseBuilder, see Issue #15 and its associated branch.

In 0.1.5, two new builders were introduced: NonsenseShipOrPub, which creates whimsical names for either sailing ships or neighborhood pubs, and BuildertextJavaclass, an entirely silly soundalike name generator inspired by this meme.

Future implementation classes for other silly purposes are planned; stay tuned to the issue registry for details.

Android Security Features (net.zer0bandwidth.android.lib.security)
The PermissionCheckpoint class checks a specified list of "dangerous" Android permissions, and asks the user to grant each of those permissions in series. This may be used by an app's main activity to request, upfront, all of the permissions that would demand individual checks in Android 6 and later. By using this class in your main activity, the rest of your app does not need to constantly check all of its dangerous permissions, or handle the exceptions caused by their absence.
Android Service Features (net.zer0bandwidth.android.lib.services)
The SimpleServiceConnection is a canonical implementation of the standard ServiceConnection interface, and provides functions sufficient to bind to an arbitrary service class which is defined by a generic parameter. This saves you from having to reimplement ServiceConnection for every service you ever write.
Telephony Features (net.zer0bandwidth.android.lib.telephony)
This package contains extensions to the standard android.telephony package. The TelephonyController provides programmatic access to telephone call functions that have been obscured in various versions of the Android SDK — most notably, it provides the endCall() method to terminate the currently-active call.
User Interface Features (net.zer0bandwidth.android.lib.ui)
This package provides commonly-used UI elements. The MultitapAlertDialog and MultitapAlertCompatDialog construct alert dialogs that require multiple taps on the positive button before the associated action is executed. This is particularly useful for constructing dialogs that ask the user to confirm certain destructive operations, like deletion of data, or logging out of an authenticated server session.