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()); }
@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(); }
private void updateViewContent() { BookmarkItem bookmarkItem = mEnhancedBookmarksModel.getBookmarkById(mBookmarkId); mTitleEditText.setText(bookmarkItem.getTitle()); mUrlEditText.setText(bookmarkItem.getUrl()); mFolderTextView.setText(mEnhancedBookmarksModel.getBookmarkTitle(bookmarkItem.getParentId())); }