// Path: app/src/main/java/com/philliphsu/clock2/util/LocalBroadcastHelper.java
// public final class LocalBroadcastHelper {
// 
//     /** Sends a local broadcast using an intent with the action specified */
//     public static void sendBroadcast(Context context, String action) {
//         sendBroadcast(context, action, null);
//     }
// 
//     /** Sends a local broadcast using an intent with the action and the extras specified */
//     public static void sendBroadcast(Context context, String action, Bundle extras) {
//         Intent intent = new Intent(action);
//         if (extras != null) {
//             intent.putExtras(extras);
//         }
//         LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
//     }
// 
//     /** Registers a BroadcastReceiver that filters intents by the actions specified */
//     public static void registerReceiver(Context context, BroadcastReceiver receiver, String... actions) {
//         IntentFilter filter = new IntentFilter();
//         for (String action : actions)
//             filter.addAction(action);
//         LocalBroadcastManager.getInstance(context).registerReceiver(receiver, filter);
//     }
// 
//     public static void unregisterReceiver(Context context, BroadcastReceiver receiver) {
//         LocalBroadcastManager.getInstance(context).unregisterReceiver(receiver);
//     }
// 
//     private LocalBroadcastHelper() {}
// }


import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.philliphsu.clock2.util.LocalBroadcastHelper;
        // positions as it binds VHs.
        c.moveToFirst();
        return c;
    }

    public Cursor queryItems() {
        // Select all rows and columns
        return queryItems(null, null);
    }

    protected Cursor queryItems(String where, String limit) {
        return mDbHelper.getReadableDatabase().query(getTableName(),
                null, // All columns
                where, // Selection, i.e. where COLUMN_* = [value we're looking for]
                null, // selection args, none b/c id already specified in selection
                null, // group by
                null, // having
                getQuerySortOrder(), // order/sort by
                limit); // limit
    }

    /**
     * Deletes all rows in this table.
     */
    public final void clear() {
        mDbHelper.getWritableDatabase().delete(getTableName(), null/*all rows*/, null);
        notifyContentChanged();
    }

    private void notifyContentChanged() {
// Path: app/src/main/java/com/philliphsu/clock2/util/LocalBroadcastHelper.java
// public final class LocalBroadcastHelper {
// 
//     /** Sends a local broadcast using an intent with the action specified */
//     public static void sendBroadcast(Context context, String action) {
//         sendBroadcast(context, action, null);
//     }
// 
//     /** Sends a local broadcast using an intent with the action and the extras specified */
//     public static void sendBroadcast(Context context, String action, Bundle extras) {
//         Intent intent = new Intent(action);
//         if (extras != null) {
//             intent.putExtras(extras);
//         }
//         LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
//     }
// 
//     /** Registers a BroadcastReceiver that filters intents by the actions specified */
//     public static void registerReceiver(Context context, BroadcastReceiver receiver, String... actions) {
//         IntentFilter filter = new IntentFilter();
//         for (String action : actions)
//             filter.addAction(action);
//         LocalBroadcastManager.getInstance(context).registerReceiver(receiver, filter);
//     }
// 
//     public static void unregisterReceiver(Context context, BroadcastReceiver receiver) {
//         LocalBroadcastManager.getInstance(context).unregisterReceiver(receiver);
//     }
// 
//     private LocalBroadcastHelper() {}
// }


// Path: app/src/main/java/com/philliphsu/clock2/data/DatabaseTableManager.java
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.philliphsu.clock2.util.LocalBroadcastHelper;

        // positions as it binds VHs.
        c.moveToFirst();
        return c;
    }

    public Cursor queryItems() {
        // Select all rows and columns
        return queryItems(null, null);
    }

    protected Cursor queryItems(String where, String limit) {
        return mDbHelper.getReadableDatabase().query(getTableName(),
                null, // All columns
                where, // Selection, i.e. where COLUMN_* = [value we're looking for]
                null, // selection args, none b/c id already specified in selection
                null, // group by
                null, // having
                getQuerySortOrder(), // order/sort by
                limit); // limit
    }

    /**
     * Deletes all rows in this table.
     */
    public final void clear() {
        mDbHelper.getWritableDatabase().delete(getTableName(), null/*all rows*/, null);
        notifyContentChanged();
    }

    private void notifyContentChanged() {
        LocalBroadcastHelper.sendBroadcast(mAppContext, getOnContentChangeAction());