Skip to content

Commit

Permalink
Bug 1329131 - Part 2: Implement selecting bookmark folder page. r=Grisha
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 6uEC9iauvZj

--HG--
extra : rebase_source : fd022ccdc3841c697aef7e5b2305afd04fd1ab5e
  • Loading branch information
wujingwe committed Apr 23, 2017
1 parent a381669 commit e1fe7cc
Show file tree
Hide file tree
Showing 15 changed files with 602 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
/**
* A dialog fragment that allows editing bookmark's url, title and changing the parent."
*/
public class BookmarkEditFragment extends DialogFragment {
public class BookmarkEditFragment extends DialogFragment implements SelectFolderCallback {

private static final String ARG_ID = "id";
private static final String ARG_URL = "url";
Expand Down Expand Up @@ -161,6 +161,19 @@ public void onClick(View v) {
}
});

folderText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (bookmark == null) {
return;
}

final SelectFolderFragment dialog = SelectFolderFragment.newInstance(bookmark.parentId, bookmark.id);
dialog.setTargetFragment(BookmarkEditFragment.this, 0);
dialog.show(getActivity().getSupportFragmentManager(), "select-bookmark-folder");
}
});

return view;
}

Expand Down Expand Up @@ -196,6 +209,18 @@ public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}

@Override
public void onFolderChanged(long parentId, String title) {
if (bookmark == null) {
// Don't update view if bookmark isn't initialized yet.
return;
}

bookmark.parentId = parentId;
bookmark.folder = title;
invalidateView(bookmark);
}

private void invalidateView(Bookmark bookmark) {
this.bookmark = bookmark;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.gecko.bookmarks;

interface SelectFolderCallback {
void onFolderChanged(long folderId, String title);
}
Loading

0 comments on commit e1fe7cc

Please sign in to comment.