Beispiel #1
0
 public void addText(
     final int iconIndex,
     final boolean isIncoming,
     final String nick,
     final String text,
     final long time,
     final short rowData,
     String serverMsgId) {
   thread.execute(
       new SqlAsyncTask.OnTaskListener() {
         @Override
         public void run() {
           try {
             ContentValues values = new ContentValues();
             values.put(DatabaseHelper.ACCOUNT_ID, protocolId);
             values.put(DatabaseHelper.CONTACT_ID, uniqueUserId);
             values.put(DatabaseHelper.SENDING_STATE, iconIndex);
             values.put(DatabaseHelper.INCOMING, isIncoming ? 0 : 1);
             values.put(DatabaseHelper.AUTHOR, nick);
             values.put(DatabaseHelper.MESSAGE, text);
             values.put(DatabaseHelper.DATE, time);
             values.put(DatabaseHelper.ROW_DATA, rowData);
             // values.put(DatabaseHelper.SERVER_MSG_ID, serverMsgId);
             SawimApplication.getDatabaseHelper()
                 .getWritableDatabase()
                 .insert(DatabaseHelper.TABLE_CHAT_HISTORY, null, values);
           } catch (Exception e) {
             DebugLog.panic(e);
           }
         }
       });
 }
Beispiel #2
0
 public void deleteText(final MessData md) {
   thread.execute(
       new SqlAsyncTask.OnTaskListener() {
         @Override
         public void run() {
           SawimApplication.getDatabaseHelper()
               .getWritableDatabase()
               .delete(
                   DatabaseHelper.TABLE_CHAT_HISTORY,
                   WHERE_ACC_CONTACT_AUTHOR_MESSAGE_ID,
                   new String[] {protocolId, uniqueUserId, md.getNick(), md.getText().toString()});
         }
       });
 }
Beispiel #3
0
 public void updateText(final MessData md) {
   thread.execute(
       new SqlAsyncTask.OnTaskListener() {
         @Override
         public void run() {
           try {
             ContentValues values = new ContentValues();
             values.put(DatabaseHelper.SENDING_STATE, md.getIconIndex());
             SawimApplication.getDatabaseHelper()
                 .getWritableDatabase()
                 .update(
                     DatabaseHelper.TABLE_CHAT_HISTORY,
                     values,
                     WHERE_ACC_CONTACT_AUTHOR_MESSAGE_ID,
                     new String[] {
                       protocolId, uniqueUserId, md.getNick(), md.getText().toString()
                     });
           } catch (Exception e) {
             DebugLog.panic(e);
           }
         }
       });
 }