aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-02-23 13:40:24 +0100
committersteckbrief <steckbrief@chefmail.de>2016-02-23 13:40:24 +0100
commit303a3a16217c1d102216ab8d91cb03ea8039dd3c (patch)
tree39fdea1f3888f3e02438933aa24700bc077e180b /src/main
parent1c983b3b0f92c547ab4b3ed0248b198d8e4dcd78 (diff)
Removed useless 'button-message' to load more messages. Implementation already done with a more convenient method
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Conversation.java12
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Message.java8
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java4
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java10
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java42
-rw-r--r--src/main/res/layout/message_status.xml9
-rw-r--r--src/main/res/values-bg/strings.xml1
-rw-r--r--src/main/res/values-cs/strings.xml1
-rw-r--r--src/main/res/values-de/strings.xml1
-rw-r--r--src/main/res/values-es/strings.xml1
-rw-r--r--src/main/res/values-eu/strings.xml1
-rw-r--r--src/main/res/values-fr/strings.xml1
-rw-r--r--src/main/res/values-ja/strings.xml1
-rw-r--r--src/main/res/values-nl/strings.xml1
-rw-r--r--src/main/res/values-pt-rBR/strings.xml1
-rw-r--r--src/main/res/values-ro-rRO/strings.xml1
-rw-r--r--src/main/res/values-sr/strings.xml1
-rw-r--r--src/main/res/values-sv/strings.xml1
-rw-r--r--src/main/res/values-tr-rTR/strings.xml1
-rw-r--r--src/main/res/values-zh-rCN/strings.xml1
-rw-r--r--src/main/res/values/strings.xml1
21 files changed, 8 insertions, 92 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java
index 4eea56b8..a99491ae 100644
--- a/src/main/java/eu/siacs/conversations/entities/Conversation.java
+++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java
@@ -307,14 +307,6 @@ public class Conversation extends AbstractEntity implements Blockable {
return this.mFirstMamReference;
}
- public void setLastClearHistory(long time) {
- setAttribute("last_clear_history",String.valueOf(time));
- }
-
- public long getLastClearHistory() {
- return getLongAttribute("last_clear_history", 0);
- }
-
public void setCorrectingMessage(Message correctingMessage) {
this.correctingMessage = correctingMessage;
}
@@ -760,10 +752,6 @@ public class Conversation extends AbstractEntity implements Blockable {
}
public long getLastMessageTransmitted() {
- long last_clear = getLastClearHistory();
- if (last_clear != 0) {
- return last_clear;
- }
synchronized (this.messages) {
for(int i = this.messages.size() - 1; i >= 0; --i) {
Message message = this.messages.get(i);
diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java
index 3f923c41..a926f9a9 100644
--- a/src/main/java/eu/siacs/conversations/entities/Message.java
+++ b/src/main/java/eu/siacs/conversations/entities/Message.java
@@ -183,14 +183,6 @@ public class Message extends AbstractEntity {
return message;
}
- public static Message createLoadMoreMessage(Conversation conversation) {
- final Message message = new Message();
- message.setType(Message.TYPE_STATUS);
- message.setConversation(conversation);
- message.setBody("LOAD_MORE");
- return message;
- }
-
@Override
public ContentValues getContentValues() {
ContentValues values = new ContentValues();
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 4c9cac69..9fee1478 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -1240,8 +1240,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
checkDeletedFiles(conversation);
callback.onMoreMessagesLoaded(messages.size(), conversation);
} else if (conversation.hasMessagesLeftOnServer()
- && account.isOnlineAndConnected()
- && conversation.getLastClearHistory() == 0) {
+ && account.isOnlineAndConnected()) {
Logging.d("mam", "mam activate, account online and connected and messages left on server");
if ((conversation.getMode() == Conversation.MODE_SINGLE && account.getXmppConnection().getFeatures().mam())
|| (conversation.getMode() == Conversation.MODE_MULTI && conversation.getMucOptions().mamSupport())) {
@@ -2734,7 +2733,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
* Therefore set this flag to true and try to get messages from server
*/
conversation.setHasMessagesLeftOnServer(true);
- conversation.setLastClearHistory(System.currentTimeMillis());
Runnable runnable = new Runnable() {
@Override
public void run() {
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index 4e045fea..9b49ea4d 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -1083,9 +1083,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
public void updateStatusMessages() {
synchronized (this.messageList) {
- if (showLoadMoreMessages(conversation)) {
- this.messageList.add(0, Message.createLoadMoreMessage(conversation));
- }
if (conversation.getMode() == Conversation.MODE_SINGLE) {
ChatState state = conversation.getIncomingChatState();
if (state == ChatState.COMPOSING) {
@@ -1109,13 +1106,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
}
- private boolean showLoadMoreMessages(final Conversation c) {
- final XmppConnection connection = c.getAccount().getXmppConnection();
- final boolean mam = connection != null && connection.getFeatures().mam();
- final MessageArchiveService service = activity.xmppConnectionService.getMessageArchiveService();
- return mam && (c.getLastClearHistory() != 0 || (c.countMessages() == 0 && c.hasMessagesLeftOnServer() && !service.queryInProgress(c)));
- }
-
protected void showSnackbar(final int message, final int action, final OnClickListener clickListener) {
snackbar.setVisibility(View.VISIBLE);
snackbar.setOnClickListener(null);
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index 8d8ea322..62caaa2d 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -441,19 +441,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.image.setOnLongClickListener(openContextMenu);
}
- private void loadMoreMessages(Conversation conversation) {
- conversation.setLastClearHistory(0);
- conversation.setHasMessagesLeftOnServer(true);
- conversation.setFirstMamReference(null);
- long timestamp = conversation.getLastMessageTransmitted();
- if (timestamp == 0) {
- timestamp = System.currentTimeMillis();
- }
- activity.setMessagesLoaded();
- activity.xmppConnectionService.getMessageArchiveService().query(conversation, 0, timestamp);
- Toast.makeText(activity, R.string.fetching_history_from_server,Toast.LENGTH_LONG).show();
- }
-
@Override
public View getView(int position, View view, ViewGroup parent) {
final Message message = getItem(position);
@@ -512,7 +499,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
view = activity.getLayoutInflater().inflate(R.layout.message_status, parent, false);
viewHolder.contact_picture = (ImageView) view.findViewById(R.id.message_photo);
viewHolder.status_message = (TextView) view.findViewById(R.id.status_message);
- viewHolder.load_more_messages = (Button) view.findViewById(R.id.load_more_messages);
break;
default:
viewHolder = null;
@@ -529,27 +515,14 @@ public class MessageAdapter extends ArrayAdapter<Message> {
boolean darkBackground = (type == RECEIVED && !isInValidSession);
if (type == STATUS) {
- if ("LOAD_MORE".equals(message.getBody())) {
- viewHolder.status_message.setVisibility(View.GONE);
- viewHolder.contact_picture.setVisibility(View.GONE);
- viewHolder.load_more_messages.setVisibility(View.VISIBLE);
- viewHolder.load_more_messages.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- loadMoreMessages(message.getConversation());
- }
- });
- } else {
- viewHolder.status_message.setVisibility(View.VISIBLE);
- viewHolder.contact_picture.setVisibility(View.VISIBLE);
- viewHolder.load_more_messages.setVisibility(View.GONE);
- if (conversation.getMode() == Conversation.MODE_SINGLE) {
- viewHolder.contact_picture.setImageBitmap(AvatarService.getInstance().get(conversation.getContact(),
- activity.getPixel(32)));
- viewHolder.contact_picture.setAlpha(0.5f);
- }
- viewHolder.status_message.setText(message.getBody());
+ viewHolder.status_message.setVisibility(View.VISIBLE);
+ viewHolder.contact_picture.setVisibility(View.VISIBLE);
+ if (conversation.getMode() == Conversation.MODE_SINGLE) {
+ viewHolder.contact_picture.setImageBitmap(AvatarService.getInstance().get(conversation.getContact(),
+ activity.getPixel(32)));
+ viewHolder.contact_picture.setAlpha(0.5f);
}
+ viewHolder.status_message.setText(message.getBody());
return view;
} else {
loadAvatar(message, viewHolder.contact_picture);
@@ -702,7 +675,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
protected ImageView contact_picture;
protected TextView status_message;
protected TextView encryption;
- public Button load_more_messages;
public ImageView edit_indicator;
}
diff --git a/src/main/res/layout/message_status.xml b/src/main/res/layout/message_status.xml
index 80166901..aa02e154 100644
--- a/src/main/res/layout/message_status.xml
+++ b/src/main/res/layout/message_status.xml
@@ -9,15 +9,6 @@
android:paddingRight="8dp"
android:paddingTop="5dp">
- <Button
- android:id="@+id/load_more_messages"
- style="?android:attr/borderlessButtonStyle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/load_more_messages"
- android:textColor="@color/accent" android:layout_centerVertical="true"
- android:layout_centerHorizontal="true"/>
-
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/message_photo"
android:layout_width="32dp"
diff --git a/src/main/res/values-bg/strings.xml b/src/main/res/values-bg/strings.xml
index b7e5a4e0..3944a4e6 100644
--- a/src/main/res/values-bg/strings.xml
+++ b/src/main/res/values-bg/strings.xml
@@ -532,7 +532,6 @@
<item quantity="one">%d съобщение</item>
<item quantity="other">%d съобщения</item>
</plurals>
- <string name="load_more_messages">Зареждане на още съобщения</string>
<string name="shared_file_with_x">Файлът е споделен с %s</string>
<string name="shared_image_with_x">Изображението е споделено с %s</string>
<string name="no_storage_permission">Conversations се нуждае от достъп до външно място за съхранение</string>
diff --git a/src/main/res/values-cs/strings.xml b/src/main/res/values-cs/strings.xml
index b3e29a82..28987d04 100644
--- a/src/main/res/values-cs/strings.xml
+++ b/src/main/res/values-cs/strings.xml
@@ -535,7 +535,6 @@
<item quantity="few">%d zprávy</item>
<item quantity="other">%d zpráv</item>
</plurals>
- <string name="load_more_messages">Načíst více zpráv</string>
<string name="shared_file_with_x">Soubor sdílen s %s</string>
<string name="shared_image_with_x">Obrázek sdílen s %s</string>
<string name="no_storage_permission">Conversations vyžaduje přístup k externímu úložišti</string>
diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml
index 8dcb9fac..4cbc0d8e 100644
--- a/src/main/res/values-de/strings.xml
+++ b/src/main/res/values-de/strings.xml
@@ -594,7 +594,6 @@
<item quantity="one">%d Nachricht</item>
<item quantity="other">%d Nachrichten</item>
</plurals>
- <string name="load_more_messages">Weitere Nachrichten laden</string>
<string name="shared_file_with_x">Datei mit %s geteilt</string>
<string name="shared_image_with_x">Bild mit %s geteilt</string>
<string name="no_storage_permission">Conversations benötigt Zugriff auf externen Speicher</string>
diff --git a/src/main/res/values-es/strings.xml b/src/main/res/values-es/strings.xml
index fd21bcea..996c5eb0 100644
--- a/src/main/res/values-es/strings.xml
+++ b/src/main/res/values-es/strings.xml
@@ -532,7 +532,6 @@
<item quantity="one">%d mensaje</item>
<item quantity="other">%d mensajes</item>
</plurals>
- <string name="load_more_messages">Cargar más mensajes</string>
<string name="shared_file_with_x">Archivo compartido con %s</string>
<string name="shared_image_with_x">Imagen compartida con %s</string>
<string name="no_storage_permission">Conversations necesita acceder al almacenamiento externo</string>
diff --git a/src/main/res/values-eu/strings.xml b/src/main/res/values-eu/strings.xml
index 9407338b..d080cfd4 100644
--- a/src/main/res/values-eu/strings.xml
+++ b/src/main/res/values-eu/strings.xml
@@ -532,7 +532,6 @@
<item quantity="one">mezu %d</item>
<item quantity="other">%d mezu</item>
</plurals>
- <string name="load_more_messages">Mezu gehiago kargatu</string>
<string name="shared_file_with_x">Fitxategia %s(r)ekin partekatu da</string>
<string name="shared_image_with_x">Irudia %s(r)ekin partekatu da</string>
<string name="no_storage_permission">Conversationsek kanpoko biltegirako sarbidea behar du</string>
diff --git a/src/main/res/values-fr/strings.xml b/src/main/res/values-fr/strings.xml
index e16504a6..f0677756 100644
--- a/src/main/res/values-fr/strings.xml
+++ b/src/main/res/values-fr/strings.xml
@@ -532,7 +532,6 @@
<item quantity="one">%d message</item>
<item quantity="other">%d messages</item>
</plurals>
- <string name="load_more_messages">Charger plus de messages</string>
<string name="shared_file_with_x">Fichier partagé avec %s</string>
<string name="shared_image_with_x">Image partagée avec %s</string>
<string name="no_storage_permission">Conversations a besoin d\'accéder au stockage externe</string>
diff --git a/src/main/res/values-ja/strings.xml b/src/main/res/values-ja/strings.xml
index d436dc99..6545dd1e 100644
--- a/src/main/res/values-ja/strings.xml
+++ b/src/main/res/values-ja/strings.xml
@@ -529,7 +529,6 @@
<plurals name="x_messages">
<item quantity="other">%d メッセージ</item>
</plurals>
- <string name="load_more_messages">さらにメッセージをロード</string>
<string name="shared_file_with_x">%s でファイルを共有</string>
<string name="shared_image_with_x">%s で画像を共有</string>
<string name="no_storage_permission">Conversations は外部ストレージにアクセスが必要です</string>
diff --git a/src/main/res/values-nl/strings.xml b/src/main/res/values-nl/strings.xml
index 5b45b935..a0df7b2c 100644
--- a/src/main/res/values-nl/strings.xml
+++ b/src/main/res/values-nl/strings.xml
@@ -532,7 +532,6 @@
<item quantity="one">%d bericht</item>
<item quantity="other">%d berichten</item>
</plurals>
- <string name="load_more_messages">Laad meer berichten</string>
<string name="shared_file_with_x">Bestand gedeeld met %s</string>
<string name="shared_image_with_x">Afbeelding gedeeld met %s</string>
<string name="no_storage_permission">Conversations heeft toegang nodig tot de externe opslag</string>
diff --git a/src/main/res/values-pt-rBR/strings.xml b/src/main/res/values-pt-rBR/strings.xml
index 368e17fa..148dc22b 100644
--- a/src/main/res/values-pt-rBR/strings.xml
+++ b/src/main/res/values-pt-rBR/strings.xml
@@ -534,7 +534,6 @@
<item quantity="one">%d mensagem</item>
<item quantity="other">%d mensagens</item>
</plurals>
- <string name="load_more_messages">Carregar mais mensagens</string>
<string name="shared_file_with_x">Arquivo compartilhado com %s</string>
<string name="shared_image_with_x">Imagem compartilhada com %s</string>
<string name="no_storage_permission">O Conversations necessita de acesso ao armazenamento externo</string>
diff --git a/src/main/res/values-ro-rRO/strings.xml b/src/main/res/values-ro-rRO/strings.xml
index 07fed1fb..a39ad3f8 100644
--- a/src/main/res/values-ro-rRO/strings.xml
+++ b/src/main/res/values-ro-rRO/strings.xml
@@ -535,7 +535,6 @@
<item quantity="few">%d mesaje</item>
<item quantity="other">%d mesaje</item>
</plurals>
- <string name="load_more_messages">Incarca mai multe mesaje</string>
<string name="shared_file_with_x">Partajeaza fisierul cu %s...</string>
<string name="shared_image_with_x">Partajeaza imaginea cu %s.</string>
<string name="no_storage_permission">Conversations are nevoie de acces la stocarea externa</string>
diff --git a/src/main/res/values-sr/strings.xml b/src/main/res/values-sr/strings.xml
index 1b206044..ceb23bf7 100644
--- a/src/main/res/values-sr/strings.xml
+++ b/src/main/res/values-sr/strings.xml
@@ -524,7 +524,6 @@
<item quantity="few">%d поруке</item>
<item quantity="other">%d порука</item>
</plurals>
- <string name="load_more_messages">Учитај још порука</string>
<string name="shared_file_with_x">Подељен фајл са %s</string>
<string name="shared_image_with_x">Подељена слика са %s</string>
<string name="no_storage_permission">Конверзацији је потребан приступ спољашњем складишту</string>
diff --git a/src/main/res/values-sv/strings.xml b/src/main/res/values-sv/strings.xml
index 4cae93c2..2a62af40 100644
--- a/src/main/res/values-sv/strings.xml
+++ b/src/main/res/values-sv/strings.xml
@@ -532,7 +532,6 @@
<item quantity="one">%d meddelande</item>
<item quantity="other">%d meddelanden</item>
</plurals>
- <string name="load_more_messages">Ladda fler meddelanden</string>
<string name="shared_file_with_x">Delade fil med %s</string>
<string name="shared_image_with_x">Delade bild med %s</string>
<string name="no_storage_permission">Conversations behöver access till extern lagring</string>
diff --git a/src/main/res/values-tr-rTR/strings.xml b/src/main/res/values-tr-rTR/strings.xml
index 87891fa1..7d8c4992 100644
--- a/src/main/res/values-tr-rTR/strings.xml
+++ b/src/main/res/values-tr-rTR/strings.xml
@@ -529,7 +529,6 @@
<plurals name="x_messages">
<item quantity="other">%d ileti</item>
</plurals>
- <string name="load_more_messages">Daha fazla ileti yükle</string>
<string name="shared_file_with_x">%s ile paylaşılan dosyalar</string>
<string name="shared_image_with_x">%s ile paylaşılan resim</string>
<string name="no_storage_permission">Conversations’ın harici depolama alanına erişmesi gerek </string>
diff --git a/src/main/res/values-zh-rCN/strings.xml b/src/main/res/values-zh-rCN/strings.xml
index 9041e756..775abaea 100644
--- a/src/main/res/values-zh-rCN/strings.xml
+++ b/src/main/res/values-zh-rCN/strings.xml
@@ -529,7 +529,6 @@
<plurals name="x_messages">
<item quantity="other">%d 条消息</item>
</plurals>
- <string name="load_more_messages">载入更多消息</string>
<string name="shared_file_with_x">用 %s 分享文件</string>
<string name="shared_image_with_x">用 %s 分享图片</string>
<string name="no_storage_permission">Conversations 需要访问外部存储</string>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index f1c1b91f..b5bba166 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -625,7 +625,6 @@
<item quantity="one">%d message</item>
<item quantity="other">%d messages</item>
</plurals>
- <string name="load_more_messages">Load more messages</string>
<string name="shared_file_with_x">Shared file with %s</string>
<string name="shared_image_with_x">Shared image with %s</string>
<string name="no_storage_permission">Conversations need access to external storage</string>