protected void tagsChanged(boolean onlySelection) { tagList.notifyTagsChanged(); if (onlySelection) tagCloud.notifyTagSelectionChanged(); else tagCloud.notifyTagsChanged(); updateStatusBar(); Bookshelf.getCurrentBook().currentPage().touch(); }
@Override protected void onResume() { super.onResume(); Book book = Bookshelf.getCurrentBook(); tagManager = book.getTagManager(); tagManager.sort(); tags = Bookshelf.getCurrentBook().currentPage().tags; tagList.setTagSet(tags); tagCloud.setTagSet(tags); updateStatusBar(); }
@Override public boolean onTouch(View view, MotionEvent event) { if (view.getId() == R.id.tag_cloud_view) { Log.d(TAG, "onTouch"); float x = event.getX(); float y = event.getY(); Tag t = tagCloud.findTagAt(x, y); if (t != null) { if (tags.contains(t)) tags.remove(t); else tags.add(t); tagsChanged(true); } } return false; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); layout = getLayoutInflater().inflate(R.layout.tag_activity, null); setContentView(layout); tagList = (TagListView) findViewById(R.id.tag_list_view); tagCloud = (TagCloudView) findViewById(R.id.tag_cloud_view); Assert.assertTrue("Tag list not created.", tagList != null); Assert.assertTrue("Tag cloud not created.", tagCloud != null); tagList.setOnItemClickListener(this); tagList.setOnItemLongClickListener(this); tagList.setOnKeyListener(this); tagCloud.setOnTouchListener(this); status = (TextView) findViewById(R.id.status); ActionBar bar = getActionBar(); bar.setTitle(R.string.tag_list_title); bar.setDisplayShowTitleEnabled(true); bar.setDisplayHomeAsUpEnabled(true); }
@Override public void onDismiss(DialogInterface dialog) { tagList.notifyTagsChanged(); tagCloud.notifyTagsChanged(); updateStatusBar(); }