當前位置: 首頁>>代碼示例>>Java>>正文


Java DraftDatabase類代碼示例

本文整理匯總了Java中org.thoughtcrime.securesms.database.DraftDatabase的典型用法代碼示例。如果您正苦於以下問題:Java DraftDatabase類的具體用法?Java DraftDatabase怎麽用?Java DraftDatabase使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DraftDatabase類屬於org.thoughtcrime.securesms.database包,在下文中一共展示了DraftDatabase類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initializeDraftFromDatabase

import org.thoughtcrime.securesms.database.DraftDatabase; //導入依賴的package包/類
private void initializeDraftFromDatabase() {
  new AsyncTask<Void, Void, List<Draft>>() {
    @Override
    protected List<Draft> doInBackground(Void... params) {
      MasterCipher masterCipher   = new MasterCipher(masterSecret);
      DraftDatabase draftDatabase = DatabaseFactory.getDraftDatabase(ConversationActivity.this);
      List<Draft> results         = draftDatabase.getDrafts(masterCipher, threadId);

      draftDatabase.clearDrafts(threadId);

      return results;
    }

    @Override
    protected void onPostExecute(List<Draft> drafts) {
      for (Draft draft : drafts) {
        try {
          if (draft.getType().equals(Draft.TEXT)) {
            composeText.setText(draft.getValue());
          } else if (draft.getType().equals(Draft.LOCATION)) {
            attachmentManager.setLocation(masterSecret, SignalPlace.deserialize(draft.getValue()), getCurrentMediaConstraints());
          } else if (draft.getType().equals(Draft.IMAGE)) {
            setMedia(Uri.parse(draft.getValue()), MediaType.IMAGE);
          } else if (draft.getType().equals(Draft.AUDIO)) {
            setMedia(Uri.parse(draft.getValue()), MediaType.AUDIO);
          } else if (draft.getType().equals(Draft.VIDEO)) {
            setMedia(Uri.parse(draft.getValue()), MediaType.VIDEO);
          }
        } catch (IOException e) {
          Log.w(TAG, e);
        }
      }

      updateToggleButtonState();
    }
  }.execute();
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:38,代碼來源:ConversationActivity.java

示例2: initializeDraftFromDatabase

import org.thoughtcrime.securesms.database.DraftDatabase; //導入依賴的package包/類
private void initializeDraftFromDatabase() {
    new AsyncTask<Void, Void, List<Draft>>() {
      @Override
      protected List<Draft> doInBackground(Void... params) {
        MasterCipher masterCipher   = new MasterCipher(masterSecret);
        DraftDatabase draftDatabase = DatabaseFactory.getDraftDatabase(ConversationActivity.this);
        List<Draft> results         = draftDatabase.getDrafts(masterCipher, threadId);

        draftDatabase.clearDrafts(threadId);

        return results;
      }

      @Override
      protected void onPostExecute(List<Draft> drafts) {
        for (Draft draft : drafts) {
// Location-TODO
//          try {
            if (draft.getType().equals(Draft.TEXT)) {
              composeText.setText(draft.getValue());
// Location-TODO
//            } else if (draft.getType().equals(Draft.LOCATION)) {
//              attachmentManager.setLocation(masterSecret, SignalPlace.deserialize(draft.getValue()), getCurrentMediaConstraints());
            } else if (draft.getType().equals(Draft.IMAGE)) {
              setMedia(Uri.parse(draft.getValue()), MediaType.IMAGE);
            } else if (draft.getType().equals(Draft.AUDIO)) {
              setMedia(Uri.parse(draft.getValue()), MediaType.AUDIO);
            } else if (draft.getType().equals(Draft.VIDEO)) {
              setMedia(Uri.parse(draft.getValue()), MediaType.VIDEO);
            }
// Location-TODO
//          } catch (IOException e) {
//            Log.w(TAG, e);
//          }
        }

        updateToggleButtonState();
      }
    }.execute();
  }
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:41,代碼來源:ConversationActivity.java

示例3: initializeDraftFromDatabase

import org.thoughtcrime.securesms.database.DraftDatabase; //導入依賴的package包/類
private void initializeDraftFromDatabase() {
  new AsyncTask<Void, Void, List<Draft>>() {
    @Override
    protected List<Draft> doInBackground(Void... params) {
      MasterCipher masterCipher   = new MasterCipher(masterSecret);
      DraftDatabase draftDatabase = DatabaseFactory.getDraftDatabase(ConversationActivity.this);
      List<Draft> results         = draftDatabase.getDrafts(masterCipher, threadId);

      draftDatabase.clearDrafts(threadId);

      return results;
    }

    @Override
    protected void onPostExecute(List<Draft> drafts) {
      boolean nativeEmojiSupported = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
      Context context              = ConversationActivity.this;

      for (Draft draft : drafts) {
        if (draft.getType().equals(Draft.TEXT) && !nativeEmojiSupported) {
          composeText.setText(Emoji.getInstance(context).emojify(draft.getValue(),
                                                                 new Emoji.InvalidatingPageLoadedListener(composeText)),
                              TextView.BufferType.SPANNABLE);
        } else if (draft.getType().equals(Draft.TEXT)) {
          composeText.setText(draft.getValue());
        } else if (draft.getType().equals(Draft.IMAGE)) {
          addAttachmentImage(Uri.parse(draft.getValue()));
        } else if (draft.getType().equals(Draft.AUDIO)) {
          addAttachmentAudio(Uri.parse(draft.getValue()));
        } else if (draft.getType().equals(Draft.VIDEO)) {
          addAttachmentVideo(Uri.parse(draft.getValue()));
        }
      }
    }
  }.execute();
}
 
開發者ID:redcracker,項目名稱:TextSecure,代碼行數:37,代碼來源:ConversationActivity.java


注:本文中的org.thoughtcrime.securesms.database.DraftDatabase類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。