Exemplo n.º 1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    setContentView(R.layout.folder_list);
    mListView = getListView();
    mListView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_INSET);
    mListView.setLongClickable(true);
    mListView.setFastScrollEnabled(true);
    mListView.setScrollingCacheEnabled(true);
    mListView.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            onOpenFolder(((FolderInfoHolder) mAdapter.getItem(id)).name);
          }
        });
    registerForContextMenu(mListView);

    mListView.setSaveEnabled(true);

    mInflater = getLayoutInflater();

    onNewIntent(getIntent());

    context = this;
  }
Exemplo n.º 2
0
  @Override
  public void onPrepareDialog(int id, Dialog dialog) {
    switch (id) {
      case DIALOG_MARK_ALL_AS_READ:
        ((AlertDialog) dialog)
            .setMessage(
                getString(
                    R.string.mark_all_as_read_dlg_instructions_fmt,
                    mSelectedContextFolder.displayName));

        break;

      default:
        super.onPrepareDialog(id, dialog);
    }
  }
Exemplo n.º 3
0
  /**
   * On resume we refresh the folder list (in the background) and we refresh the messages for any
   * folder that is currently open. This guarantees that things like unread message count and read
   * status are updated.
   */
  @Override
  public void onResume() {
    super.onResume();

    if (!mAccount.isAvailable(this)) {
      Log.i(K9.LOG_TAG, "account unavaliabale, not showing folder-list but account-list");
      startActivity(new Intent(this, Accounts.class));
      finish();
      return;
    }
    if (mAdapter == null) initializeActivityView();

    MessagingController.getInstance(getApplication()).addListener(mAdapter.mListener);
    // mAccount.refresh(Preferences.getPreferences(this));
    MessagingController.getInstance(getApplication())
        .getAccountStats(this, mAccount, mAdapter.mListener);

    onRefresh(!REFRESH_REMOTE);

    MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount);
  }
Exemplo n.º 4
0
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    getMenuInflater().inflate(R.menu.folder_context, menu);

    FolderInfoHolder folder = (FolderInfoHolder) mAdapter.getItem(info.position);

    menu.setHeaderTitle(folder.displayName);

    if (!folder.name.equals(mAccount.getTrashFolderName()))
      menu.findItem(R.id.empty_trash).setVisible(false);

    if (folder.name.equals(mAccount.getOutboxFolderName())) {
      menu.findItem(R.id.check_mail).setVisible(false);
    } else {
      menu.findItem(R.id.send_messages).setVisible(false);
    }
    if (K9.ERROR_FOLDER_NAME.equals(folder.name)) {
      menu.findItem(R.id.expunge).setVisible(false);
    }

    menu.setHeaderTitle(folder.displayName);
  }
Exemplo n.º 5
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   super.onCreateOptionsMenu(menu);
   getMenuInflater().inflate(R.menu.folder_list_option, menu);
   return true;
 }
Exemplo n.º 6
0
 @Override
 public void onPause() {
   super.onPause();
   MessagingController.getInstance(getApplication()).removeListener(mAdapter.mListener);
 }