Exemple #1
0
 public void onDeleteAction() {
   if (UI_DEBUG_PRINTS) Log.d(TAG, "onDeleteAction");
   editorFragment.setSelfAction(); // Don't try to reload the deleted
   // note
   FragmentLayout.deleteNote(this, editorFragment.getCurrentNoteId());
   goUp();
 }
Exemple #2
0
 @Override
 public void PasswordVerified(ActionResult result) {
   NotesEditorFragment editor =
       (NotesEditorFragment) getFragmentManager().findFragmentById(R.id.editor_container);
   if (editor != null) {
     editor.OnPasswordVerified(result);
   }
 }
Exemple #3
0
 public void onDeleteAction() {
   // both list and editor should be notified
   NotesListFragment list =
       (NotesListFragment) getFragmentManager().findFragmentById(R.id.noteslistfragment);
   NotesEditorFragment editor =
       (NotesEditorFragment) getFragmentManager().findFragmentById(R.id.editor_container);
   if (editor != null) editor.setSelfAction();
   // delete note
   if (list != null) list.onDelete();
 }
Exemple #4
0
 /**
  * Delete all notes given from database Only marks them as deleted if sync is enabled
  *
  * @param ids
  */
 public static void deleteNotes(Context context, Iterable<Long> ids) {
   ContentResolver resolver = context.getContentResolver();
   boolean shouldMark = shouldMarkAsDeleted(context);
   for (long id : ids) {
     if (shouldMark) {
       ContentValues values = new ContentValues();
       values.put(NotePad.Notes.COLUMN_NAME_DELETED, "1");
       resolver.update(NotesEditorFragment.getUriFrom(id), values, null, null);
     } else {
       resolver.delete(NotesEditorFragment.getUriFrom(id), null, null);
     }
   }
 }
Exemple #5
0
 @Override
 public void onMultiDelete(Collection<Long> ids, long curId) {
   if (ids.contains(curId)) {
     if (UI_DEBUG_PRINTS)
       Log.d("FragmentLayout", "id was contained in multidelete, setting no save first");
     NotesEditorFragment editor =
         (NotesEditorFragment) getFragmentManager().findFragmentById(R.id.editor_container);
     if (editor != null) {
       editor.setSelfAction();
     }
   }
   if (UI_DEBUG_PRINTS) Log.d("FragmentLayout", "deleting notes...");
   deleteNotes(this, ids);
 }
Exemple #6
0
    @Override
    protected void onCreate(Bundle savedInstanceState) {
      // Make sure to set themes before this
      super.onCreate(savedInstanceState);

      if (UI_DEBUG_PRINTS) Log.d("NotesEditorActivity", "onCreate");

      if (MainPrefs.THEME_LIGHT_ICS_AB.equals(FragmentLayout.currentTheme)) {
        setTheme(R.style.ThemeHoloLightDarkActonBar);
      } else if (MainPrefs.THEME_LIGHT.equals(FragmentLayout.currentTheme)) {
        setTheme(R.style.ThemeHoloLight);
      } else {
        setTheme(R.style.ThemeHolo);
      }

      // Set up navigation (adds nice arrow to icon)
      ActionBar actionBar = getActionBar();
      if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);
      }

      if (getResources().getBoolean(R.bool.useLandscapeView)) {
        // If the screen is now in landscape mode, we can show the
        // dialog in-line with the list so we don't need this activity.
        Log.d("NotesEditorActivity", "Landscape mode detected, killing myself");
        finish();
        return;
      }

      setContentView(R.layout.note_editor_activity);

      this.currentId = getIntent().getExtras().getLong(NotesEditorFragment.KEYID);

      if (UI_DEBUG_PRINTS) Log.d("NotesEditorActivity", "Time to show the note!");
      // if (savedInstanceState == null) {
      // During initial setup, plug in the details fragment.
      // Set this as delete listener
      editorFragment =
          (NotesEditorFragment) getFragmentManager().findFragmentById(R.id.portrait_editor);
      if (editorFragment != null) {
        editorFragment.setValues(currentId);
      }
    }
Exemple #7
0
 @Override
 public void PasswordVerified(ActionResult result) {
   if (editorFragment != null) {
     editorFragment.OnPasswordVerified(result);
   }
 }