protected TextView mUrlText;
protected ImageView mImageView;
protected String mUrl;
+ protected String mTitle;
/**
* Instantiate a bookmark item, including a default favicon.
* Return the name assigned to this bookmark item.
*/
/* package */ String getName() {
- return mTextView.getText().toString();
+ return mTitle;
}
/**
* @param name The new name for the bookmark item.
*/
/* package */ void setName(String name) {
+ if (name == null) {
+ return;
+ }
+
+ mTitle = name;
+
+ if (name.length() > BrowserSettings.MAX_TEXTVIEW_LEN) {
+ name = name.substring(0, BrowserSettings.MAX_TEXTVIEW_LEN);
+ }
+
mTextView.setText(name);
}
* @param url The new url for the bookmark item.
*/
/* package */ void setUrl(String url) {
- mUrlText.setText(url);
+ if (url == null) {
+ return;
+ }
+
mUrl = url;
+
+ if (url.length() > BrowserSettings.MAX_TEXTVIEW_LEN) {
+ url = url.substring(0, BrowserSettings.MAX_TEXTVIEW_LEN);
+ }
+
+ mUrlText.setText(url);
}
}
private void bind(BookmarkItem b, int position) {
mCursor.moveToPosition(position- mExtraOffset);
- String title = mCursor.getString(Browser.HISTORY_PROJECTION_TITLE_INDEX);
- if (title.length() > BrowserSettings.MAX_TEXTVIEW_LEN) {
- title = title.substring(0, BrowserSettings.MAX_TEXTVIEW_LEN);
- }
- b.setName(title);
+ b.setName(mCursor.getString(Browser.HISTORY_PROJECTION_TITLE_INDEX));
String url = mCursor.getString(Browser.HISTORY_PROJECTION_URL_INDEX);
- if (url.length() > BrowserSettings.MAX_TEXTVIEW_LEN) {
- url = url.substring(0, BrowserSettings.MAX_TEXTVIEW_LEN);
- }
b.setUrl(url);
byte[] data = mCursor.getBlob(Browser.HISTORY_PROJECTION_FAVICON_INDEX);
if (data != null) {