Commit edf1e4c8 authored by kkimlabs's avatar kkimlabs Committed by Commit bot

[Android] Save url in enhanced bookmark edit activity correctly.

If user edited title and url at the same time, url didn't get saved.
The reason is that we save title first, then UI is refreshed by
bookmark observer, which resets the url edit text to the original url.

BUG=530794

Review URL: https://codereview.chromium.org/1341793004

Cr-Commit-Position: refs/heads/master@{#348756}
parent f2c7f2a4
......@@ -179,14 +179,16 @@ public class EnhancedBookmarkEditActivity extends EnhancedBookmarkActivityBase {
@Override
protected void onStop() {
if (mEnhancedBookmarksModel.doesBookmarkExist(mBookmarkId)) {
final String title = mTitleEditText.getTrimmedText();
final String url = mUrlEditText.getTrimmedText();
if (!mTitleEditText.isEmpty()) {
mEnhancedBookmarksModel.setBookmarkTitle(
mBookmarkId, mTitleEditText.getTrimmedText());
mEnhancedBookmarksModel.setBookmarkTitle(mBookmarkId, title);
}
if (!mUrlEditText.isEmpty()
&& mEnhancedBookmarksModel.getBookmarkById(mBookmarkId).isUrlEditable()) {
String fixedUrl = UrlUtilities.fixupUrl(mUrlEditText.getTrimmedText());
String fixedUrl = UrlUtilities.fixupUrl(url);
if (fixedUrl != null) mEnhancedBookmarksModel.setBookmarkUrl(mBookmarkId, fixedUrl);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment