コード例 #1
0
 @Override
 public void openBookmark(BookmarkId bookmark, int launchLocation) {
   clearSelection();
   if (EnhancedBookmarkUtils.openBookmark(
       mEnhancedBookmarksModel, mActivity, bookmark, launchLocation)) {
     EnhancedBookmarkUtils.finishActivityOnPhone(mActivity);
   }
 }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    EnhancedBookmarkUtils.setTaskDescriptionInDocumentMode(this, getString(R.string.edit_bookmark));
    mEnhancedBookmarksModel = new EnhancedBookmarksModel();
    mBookmarkId =
        BookmarkId.getBookmarkIdFromString(getIntent().getStringExtra(INTENT_BOOKMARK_ID));
    mEnhancedBookmarksModel.addObserver(mBookmarkModelObserver);

    setContentView(R.layout.eb_edit);
    mTitleEditText = (EmptyAlertEditText) findViewById(R.id.title_text);
    mUrlEditText = (EmptyAlertEditText) findViewById(R.id.url_text);
    mFolderTextView = (TextView) findViewById(R.id.folder_text);
    mFolderTextView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            EnhancedBookmarkFolderSelectActivity.startFolderSelectActivity(
                EnhancedBookmarkEditActivity.this, mBookmarkId);
          }
        });
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    updateViewContent();
  }
コード例 #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    int title =
        OfflinePageBridge.isEnabled() ? R.string.offline_pages_edit_item : R.string.edit_bookmark;
    setTitle(title);
    EnhancedBookmarkUtils.setTaskDescriptionInDocumentMode(this, getString(title));
    mEnhancedBookmarksModel = new EnhancedBookmarksModel();
    mBookmarkId =
        BookmarkId.getBookmarkIdFromString(getIntent().getStringExtra(INTENT_BOOKMARK_ID));
    mEnhancedBookmarksModel.addObserver(mBookmarkModelObserver);
    assert mEnhancedBookmarksModel.getBookmarkById(mBookmarkId).isEditable();

    setContentView(R.layout.eb_edit);
    mTitleEditText = (EmptyAlertEditText) findViewById(R.id.title_text);
    mFolderTextView = (TextView) findViewById(R.id.folder_text);
    mUrlEditText = (EmptyAlertEditText) findViewById(R.id.url_text);

    mFolderTextView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            EnhancedBookmarkFolderSelectActivity.startFolderSelectActivity(
                EnhancedBookmarkEditActivity.this, mBookmarkId);
          }
        });

    if (OfflinePageBridge.isEnabled()
        && OfflinePageBridge.canSavePage(
            mEnhancedBookmarksModel.getBookmarkById(mBookmarkId).getUrl())) {
      mOfflinePageModelObserver =
          new OfflinePageModelObserver() {
            @Override
            public void offlinePageDeleted(BookmarkId bookmarkId) {
              if (mBookmarkId.equals(bookmarkId)) {
                updateOfflineSection();
              }
            }
          };

      mEnhancedBookmarksModel.getOfflinePageBridge().addObserver(mOfflinePageModelObserver);
      // Make offline page section visible and find controls.
      findViewById(R.id.offline_page_group).setVisibility(View.VISIBLE);
      getIntent().setExtrasClassLoader(WebContents.class.getClassLoader());
      mWebContents = getIntent().getParcelableExtra(INTENT_WEB_CONTENTS);
      mActivityWindowAndroid = new ActivityWindowAndroid(this, false);
      updateOfflineSection();
    }

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    updateViewContent();
  }
コード例 #4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    }
    mSnackbarManager = new SnackbarManager(getWindow());
    mBookmarkManager = new EnhancedBookmarkManager(this);
    setContentView(mBookmarkManager.getView());
    EnhancedBookmarkUtils.setTaskDescriptionInDocumentMode(this, getString(R.string.bookmarks));

    // Hack to work around inferred theme false lint error: http://crbug.com/445633
    assert (R.layout.eb_main_content != 0);
  }