aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui/interfaces
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-03-24 22:38:29 +0100
committerChristian Schneppe <christian@pix-art.de>2018-03-24 22:38:29 +0100
commit6e49572be6fdd7c54eb0d6f1939dce9fbb537024 (patch)
treedb4eadcb01743f2c2c6cdbfe63c56a3faeadad7d /src/main/java/de/pixart/messenger/ui/interfaces
parent91507dc103cbb758e49e861f8cff77ccdad09321 (diff)
WIP & fragment voodoo
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/interfaces')
-rw-r--r--src/main/java/de/pixart/messenger/ui/interfaces/OnConversationArchived.java36
-rw-r--r--src/main/java/de/pixart/messenger/ui/interfaces/OnConversationRead.java36
-rw-r--r--src/main/java/de/pixart/messenger/ui/interfaces/OnConversationSelected.java36
-rw-r--r--src/main/java/de/pixart/messenger/ui/interfaces/OnConversationsListItemUpdated.java34
-rw-r--r--src/main/java/de/pixart/messenger/ui/interfaces/OnSwipeTouchListener.java57
5 files changed, 199 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/interfaces/OnConversationArchived.java b/src/main/java/de/pixart/messenger/ui/interfaces/OnConversationArchived.java
new file mode 100644
index 000000000..beb01e690
--- /dev/null
+++ b/src/main/java/de/pixart/messenger/ui/interfaces/OnConversationArchived.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2018, Daniel Gultsch All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package de.pixart.messenger.ui.interfaces;
+
+import de.pixart.messenger.entities.Conversation;
+
+public interface OnConversationArchived {
+ void onConversationArchived(Conversation conversation);
+} \ No newline at end of file
diff --git a/src/main/java/de/pixart/messenger/ui/interfaces/OnConversationRead.java b/src/main/java/de/pixart/messenger/ui/interfaces/OnConversationRead.java
new file mode 100644
index 000000000..ab5cc607d
--- /dev/null
+++ b/src/main/java/de/pixart/messenger/ui/interfaces/OnConversationRead.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2018, Daniel Gultsch All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package de.pixart.messenger.ui.interfaces;
+
+import de.pixart.messenger.entities.Conversation;
+
+public interface OnConversationRead {
+ void onConversationRead(Conversation conversation);
+} \ No newline at end of file
diff --git a/src/main/java/de/pixart/messenger/ui/interfaces/OnConversationSelected.java b/src/main/java/de/pixart/messenger/ui/interfaces/OnConversationSelected.java
new file mode 100644
index 000000000..bd40a22fc
--- /dev/null
+++ b/src/main/java/de/pixart/messenger/ui/interfaces/OnConversationSelected.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2018, Daniel Gultsch All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package de.pixart.messenger.ui.interfaces;
+
+import de.pixart.messenger.entities.Conversation;
+
+public interface OnConversationSelected {
+ void onConversationSelected(Conversation conversation);
+}
diff --git a/src/main/java/de/pixart/messenger/ui/interfaces/OnConversationsListItemUpdated.java b/src/main/java/de/pixart/messenger/ui/interfaces/OnConversationsListItemUpdated.java
new file mode 100644
index 000000000..5e509dd54
--- /dev/null
+++ b/src/main/java/de/pixart/messenger/ui/interfaces/OnConversationsListItemUpdated.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018, Daniel Gultsch All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package de.pixart.messenger.ui.interfaces;
+
+public interface OnConversationsListItemUpdated {
+ void onConversationsListItemUpdated();
+} \ No newline at end of file
diff --git a/src/main/java/de/pixart/messenger/ui/interfaces/OnSwipeTouchListener.java b/src/main/java/de/pixart/messenger/ui/interfaces/OnSwipeTouchListener.java
new file mode 100644
index 000000000..513e0a606
--- /dev/null
+++ b/src/main/java/de/pixart/messenger/ui/interfaces/OnSwipeTouchListener.java
@@ -0,0 +1,57 @@
+package de.pixart.messenger.ui.interfaces;
+
+import android.content.Context;
+import android.util.Log;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+import android.view.View;
+
+import de.pixart.messenger.Config;
+
+public class OnSwipeTouchListener implements View.OnTouchListener {
+
+ private final GestureDetector gestureDetector;
+
+ public OnSwipeTouchListener(Context context) {
+ gestureDetector = new GestureDetector(context, new GestureListener());
+ }
+
+ public void onSwipeLeft() {
+ }
+
+ public void onSwipeRight() {
+ }
+
+ public boolean onTouch(View v, MotionEvent event) {
+ return gestureDetector.onTouchEvent(event);
+ }
+
+ private final class GestureListener extends GestureDetector.SimpleOnGestureListener {
+
+ private static final int SWIPE_DISTANCE_THRESHOLD = 100;
+ private static final int SWIPE_VELOCITY_THRESHOLD = 100;
+
+ @Override
+ public boolean onDown(MotionEvent e) {
+ return true;
+ }
+
+ @Override
+ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
+ if (e1 == null || e2 == null) {
+ Log.d(Config.LOGTAG, "Error MotionEvent");
+ return false;
+ }
+ float distanceX = e2.getX() - e1.getX();
+ float distanceY = e2.getY() - e1.getY();
+ if (Math.abs(distanceX) > Math.abs(distanceY) && Math.abs(distanceX) > SWIPE_DISTANCE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
+ if (distanceX > 0)
+ onSwipeRight();
+ else
+ onSwipeLeft();
+ return true;
+ }
+ return false;
+ }
+ }
+} \ No newline at end of file