当前位置: 首页>>代码示例>>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;未经允许,请勿转载。