コード例 #1
0
  @Override
  public void onBackPressed() {
    String newTitle = mTitleEditText.getTrimmedText();
    String newUrl = mUrlEditText.getTrimmedText();
    newUrl = UrlUtilities.fixupUrl(newUrl);
    if (newUrl == null) newUrl = "";
    mUrlEditText.setText(newUrl);

    if (!mTitleEditText.validate() || !mUrlEditText.validate()) return;

    mEnhancedBookmarksModel.setBookmarkTitle(mBookmarkId, newTitle);
    mEnhancedBookmarksModel.setBookmarkUrl(mBookmarkId, newUrl);
    super.onBackPressed();
  }
コード例 #2
0
  private void updateViewContent() {
    BookmarkItem bookmarkItem = mEnhancedBookmarksModel.getBookmarkById(mBookmarkId);

    if (!TextUtils.equals(mTitleEditText.getTrimmedText(), bookmarkItem.getTitle())) {
      mTitleEditText.setText(bookmarkItem.getTitle());
    }
    String folderTitle = mEnhancedBookmarksModel.getBookmarkTitle(bookmarkItem.getParentId());
    if (!TextUtils.equals(mFolderTextView.getText(), folderTitle)) {
      mFolderTextView.setText(folderTitle);
    }
    if (!TextUtils.equals(mUrlEditText.getTrimmedText(), bookmarkItem.getUrl())) {
      mUrlEditText.setText(bookmarkItem.getUrl());
    }
    mUrlEditText.setEnabled(bookmarkItem.isUrlEditable());
    mFolderTextView.setEnabled(bookmarkItem.isMovable());
  }
コード例 #3
0
  @Override
  protected void onStop() {
    if (mEnhancedBookmarksModel.doesBookmarkExist(mBookmarkId)) {
      final String title = mTitleEditText.getTrimmedText();
      final String url = mUrlEditText.getTrimmedText();

      if (!mTitleEditText.isEmpty()) {
        mEnhancedBookmarksModel.setBookmarkTitle(mBookmarkId, title);
      }

      if (!mUrlEditText.isEmpty()
          && mEnhancedBookmarksModel.getBookmarkById(mBookmarkId).isUrlEditable()) {
        String fixedUrl = UrlUtilities.fixupUrl(url);
        if (fixedUrl != null) mEnhancedBookmarksModel.setBookmarkUrl(mBookmarkId, fixedUrl);
      }
    }

    super.onStop();
  }
コード例 #4
0
 private void updateViewContent() {
   BookmarkItem bookmarkItem = mEnhancedBookmarksModel.getBookmarkById(mBookmarkId);
   mTitleEditText.setText(bookmarkItem.getTitle());
   mUrlEditText.setText(bookmarkItem.getUrl());
   mFolderTextView.setText(mEnhancedBookmarksModel.getBookmarkTitle(bookmarkItem.getParentId()));
 }