Add more MVP classes
This commit is contained in:
parent
964c4da15f
commit
350e665cef
42 changed files with 1690 additions and 110 deletions
|
@ -24,7 +24,7 @@
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</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" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
android:name=".SlamApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
android:name="com.google.android.gms.car.application"
|
android:name="com.google.android.gms.car.application"
|
||||||
android:resource="@xml/automotive_app_desc" />
|
android:resource="@xml/automotive_app_desc" />
|
||||||
|
|
||||||
<service android:name=".service.MyMessagingService"></service>
|
<service android:name=".service.MyMessagingService"/>
|
||||||
|
|
||||||
<receiver android:name=".receiver.MessageReadReceiver">
|
<receiver android:name=".receiver.MessageReadReceiver">
|
||||||
<intent-filter>
|
<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;
|
package de.vanitasvitae.slam;
|
||||||
|
|
||||||
import android.text.Editable;
|
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;
|
package de.vanitasvitae.slam;
|
||||||
|
|
||||||
import android.view.KeyEvent;
|
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;
|
package de.vanitasvitae.slam.mvp.contracts;
|
||||||
|
|
||||||
|
import org.jxmpp.jid.BareJid;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.vanitasvitae.slam.mvp.view.ConversationListFragment;
|
import de.vanitasvitae.slam.mvp.view.ConversationListFragment;
|
||||||
|
@ -17,6 +36,7 @@ public interface ContactListContract {
|
||||||
void onUpdateContactPresence();
|
void onUpdateContactPresence();
|
||||||
void showContactListLoadingIndicator();
|
void showContactListLoadingIndicator();
|
||||||
void hideContactListLoadingIndicator();
|
void hideContactListLoadingIndicator();
|
||||||
|
void navigateToConversation(BareJid contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Presenter {
|
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;
|
package de.vanitasvitae.slam.mvp.contracts;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.packet.Message;
|
||||||
|
import org.jxmpp.jid.EntityBareJid;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.vanitasvitae.slam.mvp.view.ConversationFragment;
|
import de.vanitasvitae.slam.mvp.view.ConversationFragment;
|
||||||
|
@ -11,13 +31,14 @@ import de.vanitasvitae.slam.mvp.view.ConversationFragment;
|
||||||
public interface ConversationContract {
|
public interface ConversationContract {
|
||||||
|
|
||||||
interface View {
|
interface View {
|
||||||
void addMessageItems(List<?> messages, boolean end);
|
void addMessageItems(List<Message> messages, boolean end);
|
||||||
void highlightMessageItem();
|
void highlightMessageItem();
|
||||||
void correctMessageItem();
|
void correctMessageItem();
|
||||||
void navigateToContactProfile();
|
void navigateToContactProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Presenter {
|
interface Presenter {
|
||||||
|
void setPeersJid(EntityBareJid jid);
|
||||||
void onConversationScrolledToTop();
|
void onConversationScrolledToTop();
|
||||||
void onComposingMessageChanged(String composingMessage);
|
void onComposingMessageChanged(String composingMessage);
|
||||||
void onMessageItemClick();
|
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;
|
package de.vanitasvitae.slam.mvp.contracts;
|
||||||
|
|
||||||
|
import org.jxmpp.jid.BareJid;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.vanitasvitae.slam.xmpp.Conversation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model-View-Presenter contract of the conversation list fragment.
|
* Model-View-Presenter contract of the conversation list fragment.
|
||||||
* Created by Paul Schaub on 01.02.18.
|
* Created by Paul Schaub on 01.02.18.
|
||||||
|
@ -9,7 +30,8 @@ import java.util.List;
|
||||||
public interface ConversationListContract {
|
public interface ConversationListContract {
|
||||||
|
|
||||||
interface View {
|
interface View {
|
||||||
void populateConversationList(List<?> conversations);
|
void populateConversationList(List<Conversation> conversations);
|
||||||
|
void navigateToConversation(BareJid contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Presenter {
|
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;
|
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;
|
package de.vanitasvitae.slam.mvp.contracts;
|
||||||
|
|
||||||
import java.util.List;
|
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;
|
package de.vanitasvitae.slam.mvp.presenter;
|
||||||
|
|
||||||
import org.jxmpp.jid.BareJid;
|
import org.jxmpp.jid.BareJid;
|
||||||
|
@ -6,9 +23,6 @@ import org.jxmpp.stringprep.XmppStringprepException;
|
||||||
|
|
||||||
import de.vanitasvitae.slam.mvp.contracts.LoginContract;
|
import de.vanitasvitae.slam.mvp.contracts.LoginContract;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Paul Schaub on 01.02.18.
|
|
||||||
*/
|
|
||||||
public class LoginPresenter implements LoginContract.Presenter {
|
public class LoginPresenter implements LoginContract.Presenter {
|
||||||
|
|
||||||
private final LoginContract.View view;
|
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;
|
package de.vanitasvitae.slam.mvp.presenter.dummy;
|
||||||
|
|
||||||
import android.os.Handler;
|
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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateContactPresence() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showContactListLoadingIndicator() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hideContactListLoadingIndicator() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void navigateToConversation(BareJid contact) {
|
||||||
|
ConversationFragment fragment = new ConversationFragment();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putString(ConversationFragment.KEY_JID, contact.toString());
|
||||||
|
fragment.setArguments(bundle);
|
||||||
|
|
||||||
|
getFragmentManager().beginTransaction()
|
||||||
|
.add(R.id.fragment_container, fragment)
|
||||||
|
.addToBackStack("conversation")
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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.view;
|
package de.vanitasvitae.slam.mvp.view;
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
@ -7,63 +24,131 @@ import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.packet.Message;
|
||||||
|
import org.jxmpp.jid.EntityBareJid;
|
||||||
|
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 butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import de.vanitasvitae.slam.R;
|
import de.vanitasvitae.slam.R;
|
||||||
|
import de.vanitasvitae.slam.mvp.PresenterFactory;
|
||||||
|
import de.vanitasvitae.slam.mvp.contracts.ConversationContract;
|
||||||
import de.vanitasvitae.slam.ui.ChatMessageEntry;
|
import de.vanitasvitae.slam.ui.ChatMessageEntry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment that shows the conversation with a user.
|
* Fragment that shows the conversation with a user.
|
||||||
*
|
|
||||||
* Created by Paul Schaub on 30.01.18.
|
|
||||||
*/
|
*/
|
||||||
public class ConversationFragment extends Fragment {
|
public class ConversationFragment extends Fragment implements ConversationContract.View {
|
||||||
|
|
||||||
|
public static final String KEY_JID = "conversationfragment_jid";
|
||||||
|
|
||||||
@BindView(R.id.recycler_chat)
|
@BindView(R.id.recycler_chat)
|
||||||
RecyclerView recyclerView;
|
RecyclerView recyclerView;
|
||||||
|
|
||||||
|
private final ConversationContract.Presenter presenter;
|
||||||
|
|
||||||
|
Map<String, Integer> messageIdIndizes = new HashMap<>();
|
||||||
|
List<Message> messages = new ArrayList<>();
|
||||||
|
|
||||||
|
private final RecyclerView.Adapter<ChatMessageEntry> chatMessageAdapter = new RecyclerView.Adapter<ChatMessageEntry>() {
|
||||||
|
@Override
|
||||||
|
public ChatMessageEntry onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View messageView = LayoutInflater.from(getActivity()).inflate(R.layout.item_chatmessage, parent, false);
|
||||||
|
messageView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
getFragmentManager().beginTransaction()
|
||||||
|
.replace(R.id.fragment_container, new ContactDetailFragment())
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return new ChatMessageEntry(messageView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(ChatMessageEntry holder, int position) {
|
||||||
|
Message message = messages.get(position);
|
||||||
|
String sender = message.getFrom().toString();
|
||||||
|
String role = "Member";
|
||||||
|
View content;
|
||||||
|
content = new TextView(getActivity());
|
||||||
|
((TextView)content).setText(message.getBody());
|
||||||
|
|
||||||
|
holder.bind(sender, role, content, "now");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return messages.size();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public ConversationFragment() {
|
||||||
|
super();
|
||||||
|
this.presenter = PresenterFactory.getInstance().createConversationPresenter(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.fragment_chat, container, false);
|
View view = inflater.inflate(R.layout.fragment_chat, container, false);
|
||||||
ButterKnife.bind(this, view);
|
ButterKnife.bind(this, view);
|
||||||
|
|
||||||
|
Bundle arguments = getArguments();
|
||||||
|
String jidString = arguments.getString(KEY_JID);
|
||||||
|
if (jidString != null) {
|
||||||
|
try {
|
||||||
|
EntityBareJid jid = JidCreate.entityBareFrom(jidString);
|
||||||
|
presenter.setPeersJid(jid);
|
||||||
|
} catch (XmppStringprepException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(final View view, Bundle savedInstanceState) {
|
public void onViewCreated(final View view, Bundle savedInstanceState) {
|
||||||
final String[] messages = new String[] {"This is an example message.", "null","This is a very long message. Its purpose is to demonstrate Slam!s ability to render longer messages in a sane way without looking too crowded."};
|
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
recyclerView.setAdapter(new RecyclerView.Adapter<ChatMessageEntry>() {
|
recyclerView.setAdapter(chatMessageAdapter);
|
||||||
@Override
|
|
||||||
public ChatMessageEntry onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
||||||
View view1 = LayoutInflater.from(getActivity()).inflate(R.layout.item_chatmessage, parent, false);
|
|
||||||
return new ChatMessageEntry(view1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(ChatMessageEntry holder, int position) {
|
|
||||||
View content;
|
|
||||||
if (position != 1) {
|
|
||||||
content = new TextView(getActivity());
|
|
||||||
((TextView)content).setText(messages[position]);
|
|
||||||
} else {
|
|
||||||
content = new ImageView(getActivity());
|
|
||||||
((ImageView)content).setImageResource(R.drawable.ic_add_a_photo_black_48dp);
|
|
||||||
}
|
|
||||||
holder.bind("alice@wonderland.lit",
|
|
||||||
"Member", content, "just now");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return messages.length;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
recyclerView.getAdapter().notifyDataSetChanged();
|
recyclerView.getAdapter().notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addMessageItems(List<Message> messages, boolean end) {
|
||||||
|
if (end) {
|
||||||
|
this.messages.addAll(messages);
|
||||||
|
} else {
|
||||||
|
this.messages.addAll(0, messages);
|
||||||
|
}
|
||||||
|
chatMessageAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void highlightMessageItem() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void correctMessageItem() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void navigateToContactProfile() {
|
||||||
|
getFragmentManager().beginTransaction()
|
||||||
|
.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out)
|
||||||
|
.add(R.id.fragment_container, new ContactDetailFragment())
|
||||||
|
.addToBackStack("detail")
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.view;
|
package de.vanitasvitae.slam.mvp.view;
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
@ -8,21 +25,70 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import org.jxmpp.jid.BareJid;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import de.vanitasvitae.slam.R;
|
import de.vanitasvitae.slam.R;
|
||||||
|
import de.vanitasvitae.slam.mvp.PresenterFactory;
|
||||||
|
import de.vanitasvitae.slam.mvp.contracts.ConversationListContract;
|
||||||
import de.vanitasvitae.slam.ui.ConversationEntry;
|
import de.vanitasvitae.slam.ui.ConversationEntry;
|
||||||
|
import de.vanitasvitae.slam.xmpp.Conversation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment that lists conversations the user takes part in.
|
* Fragment that lists conversations the user takes part in.
|
||||||
*
|
*
|
||||||
* Created by Paul Schaub on 30.01.18.
|
* Created by Paul Schaub on 30.01.18.
|
||||||
*/
|
*/
|
||||||
public class ConversationListFragment extends Fragment {
|
public class ConversationListFragment extends Fragment implements ConversationListContract.View {
|
||||||
|
|
||||||
@BindView(R.id.recycler_chatlist)
|
@BindView(R.id.recycler_chatlist)
|
||||||
RecyclerView recyclerView;
|
RecyclerView recyclerView;
|
||||||
|
|
||||||
|
private final ConversationListContract.Presenter presenter;
|
||||||
|
private final List<Conversation> conversations = new ArrayList<>();
|
||||||
|
|
||||||
|
private final RecyclerView.Adapter<ConversationEntry> conversationEntryAdapter = new RecyclerView.Adapter<ConversationEntry>() {
|
||||||
|
@Override
|
||||||
|
public ConversationEntry onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View conversationView = LayoutInflater.from(getActivity()).inflate(R.layout.chatlist_singlechat, parent, false);
|
||||||
|
return new ConversationEntry(conversationView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(final ConversationEntry holder, final int position) {
|
||||||
|
Conversation conversation = conversations.get(holder.getAdapterPosition());
|
||||||
|
String name = conversation.getContact().getNickname();
|
||||||
|
|
||||||
|
holder.bind(
|
||||||
|
name != null ? name : conversation.getContact().getJid().toString(),
|
||||||
|
conversation.getLastMessage(),
|
||||||
|
conversation.getDate(),
|
||||||
|
true);
|
||||||
|
|
||||||
|
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int pos = holder.getAdapterPosition();
|
||||||
|
navigateToConversation(conversations.get(pos).getContact().getJid());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return conversations.size();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public ConversationListFragment() {
|
||||||
|
super();
|
||||||
|
this.presenter = PresenterFactory.getInstance().createConversationListPresenter(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
@ -33,40 +99,29 @@ public class ConversationListFragment extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(final View view, Bundle savedInstanceState) {
|
public void onViewCreated(final View view, Bundle savedInstanceState) {
|
||||||
final String[] usernames = {"alice@wonderland.lit", "Bob the Builder", "Marvin"};
|
|
||||||
final String[] messages = {"But I don’t want to go among mad people", "Yes we can!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", "My name is Marvin!"};
|
|
||||||
final String[] dates = {"13:37", "yesterday", "24.12.2018"};
|
|
||||||
final boolean[] reads = {true, false, true};
|
|
||||||
|
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
recyclerView.setAdapter(new RecyclerView.Adapter<ConversationEntry>() {
|
recyclerView.setAdapter(conversationEntryAdapter);
|
||||||
@Override
|
|
||||||
public ConversationEntry onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
||||||
View view1 = LayoutInflater.from(getActivity()).inflate(R.layout.chatlist_singlechat, parent, false);
|
|
||||||
view1.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
getFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.fragment_container, new ConversationFragment()).commit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return new ConversationEntry(view1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(ConversationEntry holder, int position) {
|
|
||||||
holder.bind(
|
|
||||||
usernames[position],
|
|
||||||
messages[position],
|
|
||||||
dates[position],
|
|
||||||
reads[position]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return usernames.length;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
recyclerView.getAdapter().notifyDataSetChanged();
|
recyclerView.getAdapter().notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void populateConversationList(List<Conversation> conversations) {
|
||||||
|
this.conversations.clear();
|
||||||
|
this.conversations.addAll(conversations);
|
||||||
|
conversationEntryAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void navigateToConversation(BareJid contact) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putString(ConversationFragment.KEY_JID, contact.toString());
|
||||||
|
|
||||||
|
ConversationFragment fragment = new ConversationFragment();
|
||||||
|
fragment.setArguments(bundle);
|
||||||
|
|
||||||
|
getFragmentManager().beginTransaction()
|
||||||
|
.add(R.id.fragment_container, fragment)
|
||||||
|
.addToBackStack("conversation")
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.view;
|
package de.vanitasvitae.slam.mvp.view;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -20,6 +37,8 @@ import butterknife.OnClick;
|
||||||
import de.vanitasvitae.slam.AbstractTextWatcher;
|
import de.vanitasvitae.slam.AbstractTextWatcher;
|
||||||
import de.vanitasvitae.slam.EditorActionDoneListener;
|
import de.vanitasvitae.slam.EditorActionDoneListener;
|
||||||
import de.vanitasvitae.slam.R;
|
import de.vanitasvitae.slam.R;
|
||||||
|
import de.vanitasvitae.slam.mvp.DummyPresenterFactory;
|
||||||
|
import de.vanitasvitae.slam.mvp.PresenterFactory;
|
||||||
import de.vanitasvitae.slam.mvp.view.abstr.ThemedAppCompatActivity;
|
import de.vanitasvitae.slam.mvp.view.abstr.ThemedAppCompatActivity;
|
||||||
import de.vanitasvitae.slam.mvp.presenter.dummy.DummyLoginPresenter;
|
import de.vanitasvitae.slam.mvp.presenter.dummy.DummyLoginPresenter;
|
||||||
import de.vanitasvitae.slam.mvp.contracts.LoginContract;
|
import de.vanitasvitae.slam.mvp.contracts.LoginContract;
|
||||||
|
@ -50,6 +69,11 @@ public class LoginActivity extends ThemedAppCompatActivity implements LoginContr
|
||||||
@BindView(R.id.button_login)
|
@BindView(R.id.button_login)
|
||||||
Button buttonLogin;
|
Button buttonLogin;
|
||||||
|
|
||||||
|
public LoginActivity() {
|
||||||
|
super();
|
||||||
|
this.presenter = PresenterFactory.getInstance().createLoginPresenter(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -58,8 +82,6 @@ public class LoginActivity extends ThemedAppCompatActivity implements LoginContr
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
this.presenter = new DummyLoginPresenter(this);
|
|
||||||
|
|
||||||
// attempt login on editor action done
|
// attempt login on editor action done
|
||||||
inputPassword.setOnEditorActionListener(new EditorActionDoneListener() {
|
inputPassword.setOnEditorActionListener(new EditorActionDoneListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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.view;
|
package de.vanitasvitae.slam.mvp.view;
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
@ -17,8 +34,6 @@ import de.vanitasvitae.slam.mvp.view.abstr.ThemedAppCompatActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main activity that hosts some fragments.
|
* Main activity that hosts some fragments.
|
||||||
*
|
|
||||||
* Created by vanitas on 22.01.18.
|
|
||||||
*/
|
*/
|
||||||
public class MainActivity extends ThemedAppCompatActivity {
|
public class MainActivity extends ThemedAppCompatActivity {
|
||||||
|
|
||||||
|
@ -51,8 +66,10 @@ public class MainActivity extends ThemedAppCompatActivity {
|
||||||
drawerLayout.addDrawerListener(drawerToggle);
|
drawerLayout.addDrawerListener(drawerToggle);
|
||||||
|
|
||||||
Fragment chatListFragment = new ConversationListFragment();
|
Fragment chatListFragment = new ConversationListFragment();
|
||||||
Log.d(TAG, "Begin Transaction");
|
getFragmentManager().beginTransaction()
|
||||||
getFragmentManager().beginTransaction().add(R.id.fragment_container, chatListFragment).commit();
|
.add(R.id.fragment_container, chatListFragment)
|
||||||
|
.addToBackStack("conversation_list")
|
||||||
|
.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,9 +1,27 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package de.vanitasvitae.slam.mvp.view;
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.vanitasvitae.slam.mvp.PresenterFactory;
|
||||||
import de.vanitasvitae.slam.mvp.contracts.SearchContract;
|
import de.vanitasvitae.slam.mvp.contracts.SearchContract;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,6 +31,12 @@ import de.vanitasvitae.slam.mvp.contracts.SearchContract;
|
||||||
*/
|
*/
|
||||||
public class SearchFragment extends Fragment implements SearchContract.View {
|
public class SearchFragment extends Fragment implements SearchContract.View {
|
||||||
|
|
||||||
|
private final SearchContract.Presenter presenter;
|
||||||
|
|
||||||
|
public SearchFragment() {
|
||||||
|
this.presenter = PresenterFactory.getInstance().createSearchPresenter(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addSearchResults(List<?> results) {
|
public void addSearchResults(List<?> results) {
|
||||||
|
|
||||||
|
|
|
@ -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.view.abstr;
|
package de.vanitasvitae.slam.mvp.view.abstr;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2014 The Android Open Source Project
|
* Copyright 2018 Paul Schaub
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* This code is free software; you can redistribute it and/or modify
|
||||||
* you may not use this file except in compliance with the License.
|
* it under the terms of the GNU General Public License as published by
|
||||||
* You may obtain a copy of the License at
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* 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.
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* You should have received a copy of the GNU General Public License
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.vanitasvitae.slam.receiver;
|
package de.vanitasvitae.slam.receiver;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2014 The Android Open Source Project
|
* Copyright 2018 Paul Schaub
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* This code is free software; you can redistribute it and/or modify
|
||||||
* you may not use this file except in compliance with the License.
|
* it under the terms of the GNU General Public License as published by
|
||||||
* You may obtain a copy of the License at
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* 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.
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* You should have received a copy of the GNU General Public License
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.vanitasvitae.slam.receiver;
|
package de.vanitasvitae.slam.receiver;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2014 The Android Open Source Project
|
* Copyright 2018 Paul Schaub
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* This code is free software; you can redistribute it and/or modify
|
||||||
* you may not use this file except in compliance with the License.
|
* it under the terms of the GNU General Public License as published by
|
||||||
* You may obtain a copy of the License at
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* 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.
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* You should have received a copy of the GNU General Public License
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.vanitasvitae.slam.service;
|
package de.vanitasvitae.slam.service;
|
||||||
|
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
|
|
@ -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.ui;
|
package de.vanitasvitae.slam.ui;
|
||||||
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
|
|
@ -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.ui;
|
package de.vanitasvitae.slam.ui;
|
||||||
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
|
29
mobile/src/main/java/de/vanitasvitae/slam/xmpp/Contact.java
Normal file
29
mobile/src/main/java/de/vanitasvitae/slam/xmpp/Contact.java
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
package de.vanitasvitae.slam.xmpp;
|
||||||
|
|
||||||
|
import org.jxmpp.jid.BareJid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Paul Schaub on 11.02.18.
|
||||||
|
*/
|
||||||
|
public class Contact {
|
||||||
|
|
||||||
|
private final BareJid jid;
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
public Contact(BareJid jid) {
|
||||||
|
this(jid, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Contact(BareJid jid, String nickname) {
|
||||||
|
this.jid = jid;
|
||||||
|
this.nickname = nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BareJid getJid() {
|
||||||
|
return jid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNickname() {
|
||||||
|
return nickname;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package de.vanitasvitae.slam.xmpp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Paul Schaub on 11.02.18.
|
||||||
|
*/
|
||||||
|
public class Conversation {
|
||||||
|
|
||||||
|
private final Contact contact;
|
||||||
|
private final String lastMessage;
|
||||||
|
private final String date;
|
||||||
|
|
||||||
|
public Conversation(Contact contact) {
|
||||||
|
this(contact, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Conversation(Contact contact, String lastMessage, String date) {
|
||||||
|
this.contact = contact;
|
||||||
|
this.lastMessage = lastMessage;
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Contact getContact() {
|
||||||
|
return contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastMessage() {
|
||||||
|
return lastMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
}
|
57
mobile/src/main/res/layout/fragment_contact_detail.xml
Normal file
57
mobile/src/main/res/layout/fragment_contact_detail.xml
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<android.support.design.widget.AppBarLayout
|
||||||
|
android:id="@+id/app_bar_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="300dp">
|
||||||
|
|
||||||
|
<android.support.design.widget.CollapsingToolbarLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_scrollFlags="scroll|exitUntilCollapsed"
|
||||||
|
app:contentScrim="@color/primaryDarkColor"
|
||||||
|
app:expandedTitleMarginStart="48dp"
|
||||||
|
app:expandedTitleMarginEnd="64dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:src="?attr/themedContactDrawable"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_collapseMode="parallax"/>
|
||||||
|
|
||||||
|
<android.support.v7.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
app:layout_collapseMode="pin"/>
|
||||||
|
|
||||||
|
</android.support.design.widget.CollapsingToolbarLayout>
|
||||||
|
|
||||||
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
<android.support.v4.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="JKANSkjhkjasdhkjashdkslaudhfliuasaulkdhfliusadfhlasdkjfnlaskufskjnlaukldsjfnlkasjfnldsfjadsiljfoadsijflcmladsimnciadslmnfiadslmcvloasimcloasdicm"/>
|
||||||
|
|
||||||
|
</android.support.v4.widget.NestedScrollView>
|
||||||
|
|
||||||
|
<android.support.design.widget.FloatingActionButton
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="@dimen/activity_horizontal_margin"
|
||||||
|
android:src="@drawable/ic_share_white_48dp"
|
||||||
|
app:layout_anchor="@id/app_bar_layout"
|
||||||
|
app:layout_anchorGravity="bottom|right|end"/>
|
||||||
|
|
||||||
|
</android.support.design.widget.CoordinatorLayout>
|
Loading…
Reference in a new issue