Пример #1
0
 public void onTagSelected(String tag) {
   FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
   BrowseBookmarksFragment frag = new BrowseBookmarksFragment();
   frag.setQuery(username, tag, false);
   transaction.replace(R.id.listcontent, frag);
   transaction.commit();
 }
Пример #2
0
 public void onViewTagSelected(String tag) {
   if (findViewById(R.id.maincontent) != null) {
     BrowseBookmarksFragment frag = new BrowseBookmarksFragment();
     frag.setQuery(username, tag, false);
     FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
     transaction.replace(R.id.listcontent, frag);
     transaction.addToBackStack(null);
     transaction.commit();
   } else {
     startActivity(IntentHelper.ViewBookmarks(tag, username, this));
   }
 }
Пример #3
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.browse_bookmarks);

    Intent intent = getIntent();

    Uri data = intent.getData();
    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction t = fm.beginTransaction();

    if (fm.findFragmentById(R.id.listcontent) == null) {
      Fragment bookmarkFrag = new Fragment();

      if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        Bundle searchData = intent.getBundleExtra(SearchManager.APP_DATA);

        if (searchData != null) {
          tagname = searchData.getString("tagname");
          username = searchData.getString("username");
          unread = searchData.getBoolean("unread");
        }

        String query = intent.getStringExtra(SearchManager.QUERY);

        if (intent.hasExtra("username")) {
          username = intent.getStringExtra("username");
        }

        bookmarkFrag = new BrowseBookmarksFragment();
        ((BrowseBookmarksFragment) bookmarkFrag).setSearchQuery(query, username, tagname, unread);
      } else if (!Constants.ACTION_SEARCH_SUGGESTION.equals(intent.getAction())) {
        if (data != null) {

          if (data.getUserInfo() != "") {
            username = data.getUserInfo();
          } else username = mAccount.name;

          tagname = data.getQueryParameter("tagname");
          unread = data.getQueryParameter("unread") != null;
          path = data.getPath();
        }

        if (isMyself()) {
          bookmarkFrag = new BrowseBookmarksFragment();
          ((BrowseBookmarksFragment) bookmarkFrag).setQuery(username, tagname, unread);
        } else {
          bookmarkFrag = new BrowseBookmarkFeedFragment();
          ((BrowseBookmarkFeedFragment) bookmarkFrag).setQuery(username, tagname);
        }
      }

      t.add(R.id.listcontent, bookmarkFrag);
    }

    BrowseTagsFragment tagFrag = (BrowseTagsFragment) fm.findFragmentById(R.id.tagcontent);
    if (tagFrag != null) {
      tagFrag.setAccount(username);
      tagFrag.setAction("notpick");
    }

    if (path.contains("tags")) {
      t.hide(fm.findFragmentById(R.id.maincontent));
      findViewById(R.id.panel_collapse_button).setVisibility(View.GONE);
    } else {
      if (tagFrag != null) {
        t.hide(tagFrag);
      }
    }

    Fragment addFrag = fm.findFragmentById(R.id.addcontent);
    if (addFrag != null) {
      t.hide(addFrag);
    }

    t.commit();
  }