summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2010-10-04 09:09:42 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-10-04 09:09:42 -0700
commit90254c9659d15a11c2056e52d932a953b70a18c2 (patch)
tree12584f364c50fe2870a3b3281d334a0ae7321e5d /src
parentc350376ec7b7baa830aefb98fd5c8db1bf89c61f (diff)
parent31829b941ca8ac02a828619440cb62b64673caa8 (diff)
downloadpackages_apps_Browser-90254c9659d15a11c2056e52d932a953b70a18c2.zip
packages_apps_Browser-90254c9659d15a11c2056e52d932a953b70a18c2.tar.gz
packages_apps_Browser-90254c9659d15a11c2056e52d932a953b70a18c2.tar.bz2
Merge "fix empty bookmark folder names bug"
Diffstat (limited to 'src')
-rw-r--r--src/com/android/browser/AddBookmarkPage.java33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/com/android/browser/AddBookmarkPage.java b/src/com/android/browser/AddBookmarkPage.java
index 9070218..6c066fb 100644
--- a/src/com/android/browser/AddBookmarkPage.java
+++ b/src/com/android/browser/AddBookmarkPage.java
@@ -108,19 +108,12 @@ public class AddBookmarkPage extends Activity
if (actionId == EditorInfo.IME_NULL) {
// Only want to do this once.
if (event.getAction() == KeyEvent.ACTION_UP) {
- String name = v.getText().toString();
- long id = addFolderToCurrent(name);
- mFolderNamer.setVisibility(View.GONE);
- mAddNewFolder.setVisibility(View.VISIBLE);
- descendInto(name,id);
- InputMethodManager.getInstance(this)
- .hideSoftInputFromWindow(
- mFolderNamer.getWindowToken(), 0);
+ completeFolderNaming();
}
- // Steal the key press for both up and down
- return true;
}
}
+ // Steal the key press; otherwise a newline will be added
+ return true;
}
return false;
}
@@ -131,12 +124,7 @@ public class AddBookmarkPage extends Activity
if (mFolderSelector.getVisibility() == View.VISIBLE) {
// We are showing the folder selector.
if (mFolderNamer.getVisibility() == View.VISIBLE) {
- // Editing folder name
- String name = mFolderNamer.getText().toString();
- long id = addFolderToCurrent(mFolderNamer.getText().toString());
- descendInto(name, id);
- mFolderNamer.setVisibility(View.GONE);
- mAddNewFolder.setVisibility(View.VISIBLE);
+ completeFolderNaming();
} else {
// User has selected a folder. Go back to the opening page
mFolderSelector.setVisibility(View.GONE);
@@ -165,6 +153,18 @@ public class AddBookmarkPage extends Activity
}
}
+ private void completeFolderNaming() {
+ if (!TextUtils.isEmpty(mFolderNamer.getText())) {
+ String name = mFolderNamer.getText().toString();
+ long id = addFolderToCurrent(mFolderNamer.getText().toString());
+ descendInto(name, id);
+ mFolderNamer.setVisibility(View.GONE);
+ mAddNewFolder.setVisibility(View.VISIBLE);
+ InputMethodManager.getInstance(this).hideSoftInputFromWindow(
+ mFolderNamer.getWindowToken(), 0);
+ }
+ }
+
private long addFolderToCurrent(String name) {
// Add the folder to the database
ContentValues values = new ContentValues();
@@ -598,4 +598,5 @@ public class AddBookmarkPage extends Activity
}
return true;
}
+
}