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