Android Open Source - DashNotifier Notification Store






From Project

Back to project page DashNotifier.

License

The source code is released under:

MIT License

If you think the Android project DashNotifier listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.umang.dashnotifier.provider;
/*from w  w  w .  j  a  v  a  2s  .com*/
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

public class NotificationStore {
  private SQLiteDatabase database;
    private NotifSQLiteHelper dbHelper;
    public static final String[] allColumns = { NotifSQLiteHelper.COL_ID, 
        NotifSQLiteHelper.COL_PNAME,
        NotifSQLiteHelper.COL_NOTIF_ID, 
        NotifSQLiteHelper.COL_TITLE, 
        NotifSQLiteHelper.COL_TEXT,
        NotifSQLiteHelper.COL_EXTRA, 
        NotifSQLiteHelper.COL_TIME, 
        NotifSQLiteHelper.COL_TICKER, 
        NotifSQLiteHelper.COL_CLEAR, 
        NotifSQLiteHelper.COL_ONGOING,
        NotifSQLiteHelper.COL_COUNT};

    public NotificationStore(Context context) {
      dbHelper = new NotifSQLiteHelper(context);
    }

    public void open() throws SQLException {
      database = dbHelper.getWritableDatabase();
      
    }

    public void close() {
      dbHelper.close();
    }

    public long storeNotification(ContentValues notif) {
      long insertId = database.insert(NotifSQLiteHelper.TABLE_NOTIF, null,
          notif);
      if (insertId == -1)
        return insertId;
      else{
        Cursor temp = database.query(NotifSQLiteHelper.TABLE_NOTIF,
                allColumns, null, null, null, null, null);
        if (temp.moveToLast())
          return temp.getLong(0);
        else 
          return -1;
      }
    }

    public int removeNotification(String selection, String[] selectionArgs) {
      return database.delete(NotifSQLiteHelper.TABLE_NOTIF, selection ,selectionArgs);
    }
    
    
    
    public int removeNotification(String packageName, int notif_id){
      return database.delete(NotifSQLiteHelper.TABLE_NOTIF, 
          NotifSQLiteHelper.COL_PNAME + " = ? and " + NotifSQLiteHelper.COL_NOTIF_ID + " = ?", 
          new String[]{packageName, Integer.toString(notif_id)});
    }
    
    public int removeNotification(String id){
      return database.delete(NotifSQLiteHelper.TABLE_NOTIF, NotifSQLiteHelper.COL_ID
              + " =? ",new String[]{id} );
    }
    
    

    public int updateNotification( ContentValues values, String whereClause, String[] whereArgs){
      return database.update(NotifSQLiteHelper.TABLE_NOTIF, values, whereClause, whereArgs);
    }
    
    public Cursor query( String[] projection, String selection, String[] selectionArgs, String sortOrder){
      return database.query(NotifSQLiteHelper.TABLE_NOTIF, allColumns, selection, selectionArgs, null, null, sortOrder);
    }
    
    
    
}




Java Source Code List

com.google.android.apps.dashclock.configuration.AppChooserPreference.java
com.google.android.apps.dashclock.ui.SimplePagedTabsHelper.java
com.umang.dashnotifier.AbstractSettings.java
com.umang.dashnotifier.AppListFragment.java
com.umang.dashnotifier.AppSelectActivity.java
com.umang.dashnotifier.ClickIntentActivity.java
com.umang.dashnotifier.Commons.java
com.umang.dashnotifier.DashNotificationListenerAcc.java
com.umang.dashnotifier.DashNotificationListener.java
com.umang.dashnotifier.DashNotifierExtension10.java
com.umang.dashnotifier.DashNotifierExtension11.java
com.umang.dashnotifier.DashNotifierExtension2.java
com.umang.dashnotifier.DashNotifierExtension3.java
com.umang.dashnotifier.DashNotifierExtension4.java
com.umang.dashnotifier.DashNotifierExtension5.java
com.umang.dashnotifier.DashNotifierExtension6.java
com.umang.dashnotifier.DashNotifierExtension7.java
com.umang.dashnotifier.DashNotifierExtension8.java
com.umang.dashnotifier.DashNotifierExtension9.java
com.umang.dashnotifier.DashNotifierExtension.java
com.umang.dashnotifier.DashNotifierSettingsActivity10.java
com.umang.dashnotifier.DashNotifierSettingsActivity11.java
com.umang.dashnotifier.DashNotifierSettingsActivity2.java
com.umang.dashnotifier.DashNotifierSettingsActivity3.java
com.umang.dashnotifier.DashNotifierSettingsActivity4.java
com.umang.dashnotifier.DashNotifierSettingsActivity5.java
com.umang.dashnotifier.DashNotifierSettingsActivity6.java
com.umang.dashnotifier.DashNotifierSettingsActivity7.java
com.umang.dashnotifier.DashNotifierSettingsActivity8.java
com.umang.dashnotifier.DashNotifierSettingsActivity9.java
com.umang.dashnotifier.DashNotifierSettingsActivity.java
com.umang.dashnotifier.HelpUtils.java
com.umang.dashnotifier.IconPicker.java
com.umang.dashnotifier.PackageAdapter.java
com.umang.dashnotifier.PackageItem.java
com.umang.dashnotifier.PrefsFragment.java
com.umang.dashnotifier.UnlockReceiver.java
com.umang.dashnotifier.provider.NotifSQLiteHelper.java
com.umang.dashnotifier.provider.NotificationProvider.java
com.umang.dashnotifier.provider.NotificationStore.java