Search in sources :

Example 6 with Label

use of com.hannesdorfmann.mosby3.sample.mail.model.mail.Label in project mosby by sockeqwe.

the class MainActivity method showMails.

private void showMails(Label label, boolean removeDetailsFragment) {
    toolbarTitle = label.getName();
    toolbar.setTitle(toolbarTitle);
    if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
        drawerLayout.closeDrawer(GravityCompat.START);
    }
    getSupportFragmentManager().beginTransaction().replace(R.id.leftPane, new MailsFragmentBuilder(label).build(), FRAGMENT_TAG_LABEL).commit();
    if (removeDetailsFragment) {
        removeDetailsFragment();
    }
}
Also used : MailsFragmentBuilder(com.hannesdorfmann.mosby3.sample.mail.mails.MailsFragmentBuilder)

Example 7 with Label

use of com.hannesdorfmann.mosby3.sample.mail.model.mail.Label in project mosby by sockeqwe.

the class WriteActivity method onSendClicked.

@OnClick(R.id.send)
public void onSendClicked() {
    String email = receiver.getText().toString();
    if (TextUtils.isEmpty(email) || !emailPattern.matcher(email).matches()) {
        Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
        receiver.startAnimation(shake);
        return;
    }
    String sub = subject.getText().toString();
    if (TextUtils.isEmpty(sub)) {
        Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
        subject.startAnimation(shake);
        return;
    }
    Person receiver = null;
    if (email.equals(Person.BARNEY.getEmail())) {
        receiver = Person.BARNEY;
    } else if (email.equals(Person.LILY.getEmail())) {
        receiver = Person.LILY;
    } else if (email.equals(Person.MARSHALL.getEmail())) {
        receiver = Person.MARSHALL;
    } else if (email.equals(Person.ROBIN.getEmail())) {
        receiver = Person.ROBIN;
    } else {
        String name = email.split("@")[0];
        receiver = new Person(23, name, email, R.drawable.unknown, null, 0);
    }
    String text = message.getText().toString();
    Mail mail = new Mail().date(new Date()).label(Label.SENT).sender(Person.TED).receiver(receiver).subject(sub).text(text);
    presenter.writeMail(getApplicationContext(), mail);
}
Also used : Mail(com.hannesdorfmann.mosby3.sample.mail.model.mail.Mail) Animation(android.view.animation.Animation) Person(com.hannesdorfmann.mosby3.sample.mail.model.contact.Person) Date(java.util.Date) OnClick(butterknife.OnClick)

Example 8 with Label

use of com.hannesdorfmann.mosby3.sample.mail.model.mail.Label in project mosby by sockeqwe.

the class MenuFragment method decrementUnreadCount.

@Override
public void decrementUnreadCount(String label) {
    for (Label l : adapter.getItems()) {
        if (l.getName().equals(label)) {
            l.decrementUnreadCount();
            adapter.notifyDataSetChanged();
            return;
        }
    }
}
Also used : Label(com.hannesdorfmann.mosby3.sample.mail.model.mail.Label)

Aggregations

Label (com.hannesdorfmann.mosby3.sample.mail.model.mail.Label)5 View (android.view.View)2 TextView (android.widget.TextView)2 Person (com.hannesdorfmann.mosby3.sample.mail.model.contact.Person)2 Mail (com.hannesdorfmann.mosby3.sample.mail.model.mail.Mail)2 Date (java.util.Date)2 LayoutTransition (android.animation.LayoutTransition)1 ListPopupWindow (android.support.v7.widget.ListPopupWindow)1 Animation (android.view.animation.Animation)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 PopupWindow (android.widget.PopupWindow)1 BindView (butterknife.BindView)1 OnClick (butterknife.OnClick)1 MailsFragmentBuilder (com.hannesdorfmann.mosby3.sample.mail.mails.MailsFragmentBuilder)1 ArrayList (java.util.ArrayList)1