Exemplo n.º 1
0
  private void notifyDataChange() {
    if (marksAdapter == null) {

      marksAdapter = new BrowserBookmarksAdapter(this);
      linkView.setAdapter(marksAdapter);
    }
    marksAdapter.changeCursor(mCursor);
    marksAdapter.notifyDataSetChanged();
  }
Exemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.link_select);
    setHeadTitle(R.string.link_title);
    showLeftActionBtn(false);
    showRightActionBtn(false);
    showRightTextActionBtn(true);

    overrideRightTextActionBtn(R.string.label_ok, linkClickListener);
    linkView = (GridView) findViewById(R.id.link_listview);
    et_select = (EditText) findViewById(R.id.et_select);
    et_select.setSelection(et_select.getText().length());
    et_select.addTextChangedListener(new MyWatcher());

    queryBookMark(current_key);

    //		linkListView.setAdapter(new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1,
    // mCursor,new String[]{Browser.BookmarkColumns.URL},new int[]{android.R.id.text1}));
    marksAdapter = new BrowserBookmarksAdapter(this);
    marksAdapter.changeCursor(mCursor);
    linkView.setAdapter(marksAdapter);
    linkView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            //				Intent shortIn = (Intent)intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
            //	            link_title = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
            //	            link_url = shortIn.getData().toString();
            //	            mFavicon = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);

            Intent shortIn = new Intent(Intent.EXTRA_SHORTCUT_INTENT);
            mCursor.moveToPosition(position);
            BrowserBookmarksAdapterItem item = marksAdapter.getRowObject(mCursor, null);
            shortIn.putExtra(Intent.EXTRA_SHORTCUT_NAME, item.title);
            //				Bitmap bmp = null;
            Bitmap favbmp = null;
            Bitmap touch_icon = null;
            //				if(item.thumbnail != null) {
            //					bmp = item.thumbnail.getBitmap();
            //				}
            if (item.favIcon != null) {
              favbmp = item.favIcon;
            }
            if (item.touch_icon != null) {
              touch_icon = item.touch_icon;
            }
            shortIn.putExtra(
                Intent.EXTRA_SHORTCUT_ICON,
                BookmarkUtils.createIcon(
                    LinkSelectActivity.this,
                    touch_icon,
                    favbmp,
                    BookmarkUtils.BookmarkIconType.ICON_HOME_SHORTCUT));
            if (!TextUtils.isEmpty(item.url)) {
              shortIn.setData(Uri.parse(item.url));
            }
            setResult(RESULT_OK, shortIn);
            finish();
          }
        });
  }