Add more MVP classes

master
Paul Schaub 5 years ago
parent 964c4da15f
commit 350e665cef
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
  1. 2
      .idea/misc.xml
  2. 3
      mobile/src/main/AndroidManifest.xml
  3. 17
      mobile/src/main/java/de/vanitasvitae/slam/AbstractTextWatcher.java
  4. 17
      mobile/src/main/java/de/vanitasvitae/slam/EditorActionDoneListener.java
  5. 31
      mobile/src/main/java/de/vanitasvitae/slam/SlamApplication.java
  6. 77
      mobile/src/main/java/de/vanitasvitae/slam/mvp/DummyPresenterFactory.java
  7. 71
      mobile/src/main/java/de/vanitasvitae/slam/mvp/DummyStore.java
  8. 70
      mobile/src/main/java/de/vanitasvitae/slam/mvp/PresenterFactory.java
  9. 48
      mobile/src/main/java/de/vanitasvitae/slam/mvp/contracts/ContactDetailContract.java
  10. 20
      mobile/src/main/java/de/vanitasvitae/slam/mvp/contracts/ContactListContract.java
  11. 23
      mobile/src/main/java/de/vanitasvitae/slam/mvp/contracts/ConversationContract.java
  12. 24
      mobile/src/main/java/de/vanitasvitae/slam/mvp/contracts/ConversationListContract.java
  13. 17
      mobile/src/main/java/de/vanitasvitae/slam/mvp/contracts/LoginContract.java
  14. 17
      mobile/src/main/java/de/vanitasvitae/slam/mvp/contracts/SearchContract.java
  15. 77
      mobile/src/main/java/de/vanitasvitae/slam/mvp/presenter/ContactDetailPresenter.java
  16. 49
      mobile/src/main/java/de/vanitasvitae/slam/mvp/presenter/ContactListPresenter.java
  17. 44
      mobile/src/main/java/de/vanitasvitae/slam/mvp/presenter/ConversationListPresenter.java
  18. 61
      mobile/src/main/java/de/vanitasvitae/slam/mvp/presenter/ConversationPresenter.java
  19. 20
      mobile/src/main/java/de/vanitasvitae/slam/mvp/presenter/LoginPresenter.java
  20. 44
      mobile/src/main/java/de/vanitasvitae/slam/mvp/presenter/SearchPresenter.java
  21. 77
      mobile/src/main/java/de/vanitasvitae/slam/mvp/presenter/dummy/DummyContactDetailPresenter.java
  22. 49
      mobile/src/main/java/de/vanitasvitae/slam/mvp/presenter/dummy/DummyContactListPresenter.java
  23. 60
      mobile/src/main/java/de/vanitasvitae/slam/mvp/presenter/dummy/DummyConversationListPresenter.java
  24. 100
      mobile/src/main/java/de/vanitasvitae/slam/mvp/presenter/dummy/DummyConversationPresenter.java
  25. 17
      mobile/src/main/java/de/vanitasvitae/slam/mvp/presenter/dummy/DummyLoginPresenter.java
  26. 44
      mobile/src/main/java/de/vanitasvitae/slam/mvp/presenter/dummy/DummySearchPresenter.java
  27. 76
      mobile/src/main/java/de/vanitasvitae/slam/mvp/view/ContactDetailFragment.java
  28. 63
      mobile/src/main/java/de/vanitasvitae/slam/mvp/view/ContactListFragment.java
  29. 145
      mobile/src/main/java/de/vanitasvitae/slam/mvp/view/ConversationFragment.java
  30. 121
      mobile/src/main/java/de/vanitasvitae/slam/mvp/view/ConversationListFragment.java
  31. 26
      mobile/src/main/java/de/vanitasvitae/slam/mvp/view/LoginActivity.java
  32. 25
      mobile/src/main/java/de/vanitasvitae/slam/mvp/view/MainActivity.java
  33. 24
      mobile/src/main/java/de/vanitasvitae/slam/mvp/view/SearchFragment.java
  34. 17
      mobile/src/main/java/de/vanitasvitae/slam/mvp/view/abstr/ThemedAppCompatActivity.java
  35. 23
      mobile/src/main/java/de/vanitasvitae/slam/receiver/MessageReadReceiver.java
  36. 23
      mobile/src/main/java/de/vanitasvitae/slam/receiver/MessageReplyReceiver.java
  37. 23
      mobile/src/main/java/de/vanitasvitae/slam/service/MyMessagingService.java
  38. 17
      mobile/src/main/java/de/vanitasvitae/slam/ui/ChatMessageEntry.java
  39. 17
      mobile/src/main/java/de/vanitasvitae/slam/ui/ConversationEntry.java
  40. 29
      mobile/src/main/java/de/vanitasvitae/slam/xmpp/Contact.java
  41. 33
      mobile/src/main/java/de/vanitasvitae/slam/xmpp/Conversation.java
  42. 57
      mobile/src/main/res/layout/fragment_contact_detail.xml

@ -24,7 +24,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

@ -9,6 +9,7 @@
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application
android:name=".SlamApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@ -31,7 +32,7 @@
android:name="com.google.android.gms.car.application"
android:resource="@xml/automotive_app_desc" />
<service android:name=".service.MyMessagingService"></service>
<service android:name=".service.MyMessagingService"/>
<receiver android:name=".receiver.MessageReadReceiver">
<intent-filter>

@ -1,3 +1,20 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam;
import android.text.Editable;

@ -1,3 +1,20 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam;
import android.view.KeyEvent;

@ -0,0 +1,31 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam;
import android.app.Application;
import de.vanitasvitae.slam.mvp.DummyPresenterFactory;
import de.vanitasvitae.slam.mvp.PresenterFactory;
public class SlamApplication extends Application {
public SlamApplication() {
super();
PresenterFactory.setInstance(new DummyPresenterFactory());
}
}

@ -0,0 +1,77 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp;
import org.jxmpp.stringprep.XmppStringprepException;
import de.vanitasvitae.slam.mvp.contracts.ContactDetailContract;
import de.vanitasvitae.slam.mvp.contracts.ContactListContract;
import de.vanitasvitae.slam.mvp.contracts.ConversationContract;
import de.vanitasvitae.slam.mvp.contracts.ConversationListContract;
import de.vanitasvitae.slam.mvp.contracts.LoginContract;
import de.vanitasvitae.slam.mvp.contracts.SearchContract;
import de.vanitasvitae.slam.mvp.presenter.dummy.DummyContactDetailPresenter;
import de.vanitasvitae.slam.mvp.presenter.dummy.DummyContactListPresenter;
import de.vanitasvitae.slam.mvp.presenter.dummy.DummyConversationListPresenter;
import de.vanitasvitae.slam.mvp.presenter.dummy.DummyConversationPresenter;
import de.vanitasvitae.slam.mvp.presenter.dummy.DummyLoginPresenter;
import de.vanitasvitae.slam.mvp.presenter.dummy.DummySearchPresenter;
public class DummyPresenterFactory extends PresenterFactory {
public static DummyStore STORE;
public DummyPresenterFactory() {
super();
try {
STORE = new DummyStore();
} catch (XmppStringprepException e) {
e.printStackTrace();
}
}
@Override
public ContactDetailContract.Presenter createContactDetailPresenter(ContactDetailContract.View view) {
return new DummyContactDetailPresenter(view);
}
@Override
public ContactListContract.Presenter createContactListPresenter(ContactListContract.View view) {
return new DummyContactListPresenter(view);
}
@Override
public ConversationListContract.Presenter createConversationListPresenter(ConversationListContract.View view) {
return new DummyConversationListPresenter(view);
}
@Override
public ConversationContract.Presenter createConversationPresenter(ConversationContract.View view) {
return new DummyConversationPresenter(view);
}
@Override
public LoginContract.Presenter createLoginPresenter(LoginContract.View view) {
return new DummyLoginPresenter(view);
}
@Override
public SearchContract.Presenter createSearchPresenter(SearchContract.View view) {
return new DummySearchPresenter(view);
}
}

@ -0,0 +1,71 @@
package de.vanitasvitae.slam.mvp;
import org.jivesoftware.smack.packet.Message;
import org.jxmpp.jid.BareJid;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.stringprep.XmppStringprepException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import de.vanitasvitae.slam.xmpp.Contact;
/**
* Created by Paul Schaub on 11.02.18.
*/
public class DummyStore {
public final Map<BareJid, List<Message>> conversations = new HashMap<>();
public final List<Contact> contacts = new ArrayList<>();
public DummyStore() throws XmppStringprepException {
contacts.addAll(contacts());
conversations.put(contacts.get(0).getJid(), aliceMessages());
conversations.put(contacts.get(1).getJid(), bobMessages());
}
private List<Contact> contacts() throws XmppStringprepException {
List<Contact> l = new ArrayList<>();
l.add(new Contact(JidCreate.entityBareFrom("alice@wonderland.lit"), "Alice"));
l.add(new Contact(JidCreate.entityBareFrom("bob@builder.tv")));
l.add(new Contact(JidCreate.entityBareFrom("juliet@capulet.lit"), "Juliet"));
l.add(new Contact(JidCreate.entityBareFrom("romeo@montague.lit"), "Romeo <3"));
return l;
}
private List<Message> aliceMessages() throws XmppStringprepException {
BareJid jid = JidCreate.entityBareFrom("alice@wonderland.lit");
List<Message> m = new ArrayList<>();
Message m1 = new Message();
m1.setFrom(jid);
m1.setBody("Hi!");
m.add(m1);
return m;
}
private List<Message> bobMessages() throws XmppStringprepException {
BareJid jid = JidCreate.entityBareFrom("bob@builder.tv");
List<Message> m = new ArrayList<>();
Message m1 = new Message();
m1.setFrom(jid);
m1.setBody("Hello, I'm Bob!");
m.add(m1);
Message m2 = new Message();
m2.setFrom(jid);
m2.setBody("Do you think we can do it?");
m.add(m2);
Message m3 = new Message();
m3.setFrom(jid);
m3.setBody("YES WE CAN!!!");
m.add(m3);
return m;
}
}

@ -0,0 +1,70 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp;
import org.jxmpp.jid.BareJid;
import de.vanitasvitae.slam.mvp.contracts.ContactDetailContract;
import de.vanitasvitae.slam.mvp.contracts.ContactListContract;
import de.vanitasvitae.slam.mvp.contracts.ConversationContract;
import de.vanitasvitae.slam.mvp.contracts.ConversationListContract;
import de.vanitasvitae.slam.mvp.contracts.LoginContract;
import de.vanitasvitae.slam.mvp.contracts.SearchContract;
import de.vanitasvitae.slam.mvp.presenter.ContactDetailPresenter;
import de.vanitasvitae.slam.mvp.presenter.ContactListPresenter;
import de.vanitasvitae.slam.mvp.presenter.ConversationListPresenter;
import de.vanitasvitae.slam.mvp.presenter.ConversationPresenter;
import de.vanitasvitae.slam.mvp.presenter.LoginPresenter;
import de.vanitasvitae.slam.mvp.presenter.SearchPresenter;
public class PresenterFactory {
private static PresenterFactory INSTANCE;
public static PresenterFactory getInstance() {
return INSTANCE;
}
public static void setInstance(PresenterFactory instance) {
INSTANCE = instance;
}
public ContactDetailContract.Presenter createContactDetailPresenter(ContactDetailContract.View view) {
return new ContactDetailPresenter(view);
}
public ContactListContract.Presenter createContactListPresenter(ContactListContract.View view) {
return new ContactListPresenter(view);
}
public ConversationListContract.Presenter createConversationListPresenter(ConversationListContract.View view) {
return new ConversationListPresenter(view);
}
public ConversationContract.Presenter createConversationPresenter(ConversationContract.View view) {
return new ConversationPresenter(view);
}
public LoginContract.Presenter createLoginPresenter(LoginContract.View view) {
return new LoginPresenter(view);
}
public SearchContract.Presenter createSearchPresenter(SearchContract.View view) {
return new SearchPresenter(view);
}
}

@ -0,0 +1,48 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.contracts;
import org.jivesoftware.smack.packet.Presence;
import java.util.List;
/**
* Model-View-Presenter contract for the {@link de.vanitasvitae.slam.mvp.view.ContactDetailFragment}.
*/
public interface ContactDetailContract {
interface View {
void setContactAvatar();
void setNickname(String nickname);
void setPresence(Presence presence);
void clearFingerprints();
void addFingerprints(List<?> fingerprints);
}
interface Presenter {
void onAvatarClick();
void onSharedMediaClick();
void onAudioCallClick();
void onVideoCallClick();
void onShareContactClick();
void onBlockContactClick();
void onEditClick();
void onDeleteClick();
void onFingerprintTrustChanged();
}
}

@ -1,5 +1,24 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.contracts;
import org.jxmpp.jid.BareJid;
import java.util.List;
import de.vanitasvitae.slam.mvp.view.ConversationListFragment;
@ -17,6 +36,7 @@ public interface ContactListContract {
void onUpdateContactPresence();
void showContactListLoadingIndicator();
void hideContactListLoadingIndicator();
void navigateToConversation(BareJid contact);
}
interface Presenter {

@ -1,5 +1,25 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.contracts;
import org.jivesoftware.smack.packet.Message;
import org.jxmpp.jid.EntityBareJid;
import java.util.List;
import de.vanitasvitae.slam.mvp.view.ConversationFragment;
@ -11,13 +31,14 @@ import de.vanitasvitae.slam.mvp.view.ConversationFragment;
public interface ConversationContract {
interface View {
void addMessageItems(List<?> messages, boolean end);
void addMessageItems(List<Message> messages, boolean end);
void highlightMessageItem();
void correctMessageItem();
void navigateToContactProfile();
}
interface Presenter {
void setPeersJid(EntityBareJid jid);
void onConversationScrolledToTop();
void onComposingMessageChanged(String composingMessage);
void onMessageItemClick();

@ -1,7 +1,28 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.contracts;
import org.jxmpp.jid.BareJid;
import java.util.List;
import de.vanitasvitae.slam.xmpp.Conversation;
/**
* Model-View-Presenter contract of the conversation list fragment.
* Created by Paul Schaub on 01.02.18.
@ -9,7 +30,8 @@ import java.util.List;
public interface ConversationListContract {
interface View {
void populateConversationList(List<?> conversations);
void populateConversationList(List<Conversation> conversations);
void navigateToConversation(BareJid contact);
}
interface Presenter {

@ -1,3 +1,20 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.contracts;
/**

@ -1,3 +1,20 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.contracts;
import java.util.List;

@ -0,0 +1,77 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.presenter;
import org.jxmpp.jid.BareJid;
import de.vanitasvitae.slam.mvp.contracts.ContactDetailContract;
public class ContactDetailPresenter implements ContactDetailContract.Presenter {
private final ContactDetailContract.View view;
private BareJid contact;
public ContactDetailPresenter(ContactDetailContract.View view) {
this.view = view;
}
@Override
public void onAvatarClick() {
}
@Override
public void onSharedMediaClick() {
}
@Override
public void onAudioCallClick() {
}
@Override
public void onVideoCallClick() {
}
@Override
public void onShareContactClick() {
}
@Override
public void onBlockContactClick() {
}
@Override
public void onEditClick() {
}
@Override
public void onDeleteClick() {
}
@Override
public void onFingerprintTrustChanged() {
}
}

@ -0,0 +1,49 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.presenter;
import de.vanitasvitae.slam.mvp.contracts.ContactListContract;
public class ContactListPresenter implements ContactListContract.Presenter {
private final ContactListContract.View view;
public ContactListPresenter(ContactListContract.View view) {
this.view = view;
}
@Override
public void onContactListItemClick() {
}
@Override
public void onContactListItemLongClick() {
}
@Override
public void addNewContact() {
}
@Override
public void deleteContact() {
}
}

@ -0,0 +1,44 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.presenter;
import de.vanitasvitae.slam.mvp.contracts.ConversationListContract;
public class ConversationListPresenter implements ConversationListContract.Presenter {
private final ConversationListContract.View view;
public ConversationListPresenter(ConversationListContract.View view) {
this.view = view;
}
@Override
public void onConversationClick() {
}
@Override
public void onConversationLongClick() {
}
@Override
public void load() {
}
}

@ -0,0 +1,61 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.presenter;
import org.jxmpp.jid.EntityBareJid;
import de.vanitasvitae.slam.mvp.contracts.ConversationContract;
public class ConversationPresenter implements ConversationContract.Presenter {
private final ConversationContract.View view;
public ConversationPresenter(ConversationContract.View view) {
this.view = view;
}
@Override
public void setPeersJid(EntityBareJid jid) {
}
@Override
public void onConversationScrolledToTop() {
}
@Override
public void onComposingMessageChanged(String composingMessage) {
}
@Override
public void onMessageItemClick() {
}
@Override
public void onMessageItemLongClick() {
}
@Override
public void onMessageItemSenderClick() {
}
}

@ -1,3 +1,20 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.presenter;
import org.jxmpp.jid.BareJid;
@ -6,9 +23,6 @@ import org.jxmpp.stringprep.XmppStringprepException;
import de.vanitasvitae.slam.mvp.contracts.LoginContract;
/**
* Created by Paul Schaub on 01.02.18.
*/
public class LoginPresenter implements LoginContract.Presenter {
private final LoginContract.View view;

@ -0,0 +1,44 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.presenter;
import de.vanitasvitae.slam.mvp.contracts.SearchContract;
public class SearchPresenter implements SearchContract.Presenter {
private final SearchContract.View view;
public SearchPresenter(SearchContract.View view) {
this.view = view;
}
@Override
public void onSearchQueryChanged(String query) {
}
@Override
public void onSearchResultClick() {
}
@Override
public void onSearchScrolledToBottom() {
}
}

@ -0,0 +1,77 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.presenter.dummy;
import org.jxmpp.jid.BareJid;
import de.vanitasvitae.slam.mvp.contracts.ContactDetailContract;
public class DummyContactDetailPresenter implements ContactDetailContract.Presenter {
private final ContactDetailContract.View view;
private BareJid contact;
public DummyContactDetailPresenter(ContactDetailContract.View view) {
this.view = view;
}
@Override
public void onAvatarClick() {
}
@Override
public void onSharedMediaClick() {
}
@Override
public void onAudioCallClick() {
}
@Override
public void onVideoCallClick() {
}
@Override
public void onShareContactClick() {
}
@Override
public void onBlockContactClick() {
}
@Override
public void onEditClick() {
}
@Override
public void onDeleteClick() {
}
@Override
public void onFingerprintTrustChanged() {
}
}

@ -0,0 +1,49 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.presenter.dummy;
import de.vanitasvitae.slam.mvp.contracts.ContactListContract;
public class DummyContactListPresenter implements ContactListContract.Presenter {
private final ContactListContract.View view;
public DummyContactListPresenter(ContactListContract.View view) {
this.view = view;
}
@Override
public void onContactListItemClick() {
view.navigateToConversation(null);
}
@Override
public void onContactListItemLongClick() {
}
@Override
public void addNewContact() {
}
@Override
public void deleteContact() {
}
}

@ -0,0 +1,60 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.presenter.dummy;
import org.jivesoftware.smack.packet.Message;
import java.util.ArrayList;
import java.util.List;
import de.vanitasvitae.slam.mvp.DummyPresenterFactory;
import de.vanitasvitae.slam.mvp.contracts.ConversationListContract;
import de.vanitasvitae.slam.xmpp.Contact;
import de.vanitasvitae.slam.xmpp.Conversation;
public class DummyConversationListPresenter implements ConversationListContract.Presenter {
private final ConversationListContract.View view;
public DummyConversationListPresenter(ConversationListContract.View view) {
this.view = view;
List<Conversation> conversationList = new ArrayList<>();
for (Contact contact : DummyPresenterFactory.STORE.contacts) {
List<Message> m = DummyPresenterFactory.STORE.conversations.get(contact.getJid());
if (m != null) {
conversationList.add(new Conversation(contact, m.get(m.size() - 1).getBody(), "now"));
}
}
view.populateConversationList(conversationList);
}
@Override
public void onConversationClick() {
}
@Override
public void onConversationLongClick() {
}
@Override
public void load() {
}
}

@ -0,0 +1,100 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.presenter.dummy;
import org.jivesoftware.smack.packet.Message;
import org.jxmpp.jid.BareJid;
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.stringprep.XmppStringprepException;
import java.util.ArrayList;
import java.util.List;
import de.vanitasvitae.slam.mvp.contracts.ConversationContract;
public class DummyConversationPresenter implements ConversationContract.Presenter {
private final ConversationContract.View view;
private final List<Message> dummyMessages = new ArrayList<>();
public DummyConversationPresenter(ConversationContract.View view) {
this.view = view;
populateDummyMessages();
this.view.addMessageItems(dummyMessages, true);
}
private void populateDummyMessages() {
try {
BareJid alice = JidCreate.bareFrom("alice@wonderland.lit");
Message m1 = new Message();
m1.setFrom(alice);
m1.setBody("Hello World!");
dummyMessages.add(m1);
Message m2 = new Message();
m2.setFrom(alice);
m2.setBody("This is a demonstration of a SLAM! conversation.");
dummyMessages.add(m2);
Message m3 = new Message();
m3.setFrom(alice);
m3.setBody("As you can see, long messages are displayed just as nice as short messages.");
dummyMessages.add(m3);
Message m4 = new Message();
m4.setFrom(alice);
m4.setBody("Easy usability is one of SLAM!s main focus points. I hope, that SLAM! will develop further to become one very easy and intuitive messenger.");
dummyMessages.add(m4);
} catch (XmppStringprepException e) {
e.printStackTrace();
}
}
@Override
public void setPeersJid(EntityBareJid jid) {
}
@Override
public void onConversationScrolledToTop() {
}
@Override
public void onComposingMessageChanged(String composingMessage) {
}
@Override
public void onMessageItemClick() {
}
@Override
public void onMessageItemLongClick() {
}
@Override
public void onMessageItemSenderClick() {
}
}

@ -1,3 +1,20 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.presenter.dummy;
import android.os.Handler;

@ -0,0 +1,44 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.presenter.dummy;
import de.vanitasvitae.slam.mvp.contracts.SearchContract;
public class DummySearchPresenter implements SearchContract.Presenter {
private final SearchContract.View view;
public DummySearchPresenter(SearchContract.View view) {
this.view = view;
}
@Override
public void onSearchQueryChanged(String query) {
}
@Override
public void onSearchResultClick() {
}
@Override
public void onSearchScrolledToBottom() {
}
}

@ -0,0 +1,76 @@
/*
* Copyright 2018 Paul Schaub
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package de.vanitasvitae.slam.mvp.view;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.jivesoftware.smack.packet.Presence;
import org.jxmpp.jid.BareJid;
import java.util.List;
import butterknife.ButterKnife;
import de.vanitasvitae.slam.R;
import de.vanitasvitae.slam.mvp.PresenterFactory;
import de.vanitasvitae.slam.mvp.contracts.ContactDetailContract;
public class ContactDetailFragment extends Fragment implements ContactDetailContract.View {
private final ContactDetailContract.Presenter presenter;
public ContactDetailFragment() {
this.presenter = PresenterFactory.getInstance().createContactDetailPresenter(this);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_contact_detail, container, false);
ButterKnife.bind(this, view);
return view;
}
@Override
public void setContactAvatar() {
}
@Override
public void setNickname(String nickname) {
}
@Override
public void setPresence(Presence presence) {
}
@Override
public void clearFingerprints() {
}
@Override
public void addFingerprints(List<?> fingerprints) {
}
}

@ -0,0 +1,63 @@
package de.vanitasvitae.slam.mvp.view;
import android.app.Fragment;
import android.os.Bundle;
import org.jxmpp.jid.BareJid;
import java.util.List;
import de.vanitasvitae.slam.R;
import de.vanitasvitae.slam.mvp.PresenterFactory;
import de.vanitasvitae.slam.mvp.contracts.ContactListContract;
/**
* Created by Paul Schaub on 11.02.18.
*/
public class ContactListFragment extends Fragment implements ContactListContract.View {
private final ContactListContract.Presenter presenter;
public ContactListFragment() {
super();
this.presenter = PresenterFactory.getInstance().createContactListPresenter(this);
}
@Override
public void addContactListItems(List<?> contacts) {
}
@Override
public void clearContactListItems() {
}