diff --git a/art/ic_action_send_now.svg b/art/ic_action_send_now.svg
new file mode 100644
index 000000000..6bde9158f
--- /dev/null
+++ b/art/ic_action_send_now.svg
@@ -0,0 +1,69 @@
+
+
+
+
diff --git a/res/drawable-hdpi/ic_action_send_now.png b/res/drawable-hdpi/ic_action_send_now.png
deleted file mode 100644
index ff0e369ee..000000000
Binary files a/res/drawable-hdpi/ic_action_send_now.png and /dev/null differ
diff --git a/res/drawable-hdpi/ic_action_send_now_away.png b/res/drawable-hdpi/ic_action_send_now_away.png
new file mode 100644
index 000000000..505cbe63a
Binary files /dev/null and b/res/drawable-hdpi/ic_action_send_now_away.png differ
diff --git a/res/drawable-hdpi/ic_action_send_now_dnd.png b/res/drawable-hdpi/ic_action_send_now_dnd.png
new file mode 100644
index 000000000..a376524d7
Binary files /dev/null and b/res/drawable-hdpi/ic_action_send_now_dnd.png differ
diff --git a/res/drawable-hdpi/ic_action_send_now_offline.png b/res/drawable-hdpi/ic_action_send_now_offline.png
new file mode 100644
index 000000000..d4d2d5103
Binary files /dev/null and b/res/drawable-hdpi/ic_action_send_now_offline.png differ
diff --git a/res/drawable-hdpi/ic_action_send_now_online.png b/res/drawable-hdpi/ic_action_send_now_online.png
new file mode 100644
index 000000000..48676f7bd
Binary files /dev/null and b/res/drawable-hdpi/ic_action_send_now_online.png differ
diff --git a/res/drawable-mdpi/ic_action_send_now_away.png b/res/drawable-mdpi/ic_action_send_now_away.png
new file mode 100644
index 000000000..0fdca901a
Binary files /dev/null and b/res/drawable-mdpi/ic_action_send_now_away.png differ
diff --git a/res/drawable-mdpi/ic_action_send_now_dnd.png b/res/drawable-mdpi/ic_action_send_now_dnd.png
new file mode 100644
index 000000000..c0aef36cc
Binary files /dev/null and b/res/drawable-mdpi/ic_action_send_now_dnd.png differ
diff --git a/res/drawable-mdpi/ic_action_send_now_offline.png b/res/drawable-mdpi/ic_action_send_now_offline.png
new file mode 100644
index 000000000..7723f4aa9
Binary files /dev/null and b/res/drawable-mdpi/ic_action_send_now_offline.png differ
diff --git a/res/drawable-mdpi/ic_action_send_now_online.png b/res/drawable-mdpi/ic_action_send_now_online.png
new file mode 100644
index 000000000..39d00ee48
Binary files /dev/null and b/res/drawable-mdpi/ic_action_send_now_online.png differ
diff --git a/res/drawable-xhdpi/ic_action_send_now.png b/res/drawable-xhdpi/ic_action_send_now.png
deleted file mode 100644
index 373dde239..000000000
Binary files a/res/drawable-xhdpi/ic_action_send_now.png and /dev/null differ
diff --git a/res/drawable-xhdpi/ic_action_send_now_away.png b/res/drawable-xhdpi/ic_action_send_now_away.png
new file mode 100644
index 000000000..bb999d85d
Binary files /dev/null and b/res/drawable-xhdpi/ic_action_send_now_away.png differ
diff --git a/res/drawable-xhdpi/ic_action_send_now_dnd.png b/res/drawable-xhdpi/ic_action_send_now_dnd.png
new file mode 100644
index 000000000..a0bf5561c
Binary files /dev/null and b/res/drawable-xhdpi/ic_action_send_now_dnd.png differ
diff --git a/res/drawable-xhdpi/ic_action_send_now_offline.png b/res/drawable-xhdpi/ic_action_send_now_offline.png
new file mode 100644
index 000000000..6da9ff7bd
Binary files /dev/null and b/res/drawable-xhdpi/ic_action_send_now_offline.png differ
diff --git a/res/drawable-xhdpi/ic_action_send_now_online.png b/res/drawable-xhdpi/ic_action_send_now_online.png
new file mode 100644
index 000000000..348ba657d
Binary files /dev/null and b/res/drawable-xhdpi/ic_action_send_now_online.png differ
diff --git a/res/drawable-xxhdpi/ic_action_send_now_away.png b/res/drawable-xxhdpi/ic_action_send_now_away.png
new file mode 100644
index 000000000..12ec4d33f
Binary files /dev/null and b/res/drawable-xxhdpi/ic_action_send_now_away.png differ
diff --git a/res/drawable-xxhdpi/ic_action_send_now_dnd.png b/res/drawable-xxhdpi/ic_action_send_now_dnd.png
new file mode 100644
index 000000000..7719f81a9
Binary files /dev/null and b/res/drawable-xxhdpi/ic_action_send_now_dnd.png differ
diff --git a/res/drawable-xxhdpi/ic_action_send_now_offline.png b/res/drawable-xxhdpi/ic_action_send_now_offline.png
new file mode 100644
index 000000000..188958132
Binary files /dev/null and b/res/drawable-xxhdpi/ic_action_send_now_offline.png differ
diff --git a/res/drawable-xxhdpi/ic_action_send_now_online.png b/res/drawable-xxhdpi/ic_action_send_now_online.png
new file mode 100644
index 000000000..29bde36e3
Binary files /dev/null and b/res/drawable-xxhdpi/ic_action_send_now_online.png differ
diff --git a/res/layout/fragment_conversation.xml b/res/layout/fragment_conversation.xml
index b16e41132..91921fb56 100644
--- a/res/layout/fragment_conversation.xml
+++ b/res/layout/fragment_conversation.xml
@@ -58,7 +58,7 @@
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="?android:selectableItemBackground"
- android:src="@drawable/ic_action_send_now" />
+ android:src="@drawable/ic_action_send_now_offline" />
Please be very careful with those
Increase font size
Use larger font sizes across the entire app
+ Send button indicates status
+ Colorize send button to indicate a contacs status
\ No newline at end of file
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index f0d64e39c..47508c9e2 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -69,6 +69,11 @@
android:key="use_larger_font"
android:title="@string/pref_use_larger_font"
android:summary="@string/pref_use_larger_font_summary"/>
+
listAdapter;
- private OnConversationUpdate onConvChanged = new OnConversationUpdate() {
-
- @Override
- public void onConversationUpdate() {
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- updateConversationList();
- if (paneShouldBeOpen) {
- if (conversationList.size() >= 1) {
- swapConversationFragment();
- } else {
- startActivity(new Intent(getApplicationContext(),
- StartConversationActivity.class));
- finish();
- }
- }
- ConversationFragment selectedFragment = (ConversationFragment) getFragmentManager()
- .findFragmentByTag("conversation");
- if (selectedFragment != null) {
- selectedFragment.updateMessages();
- }
- }
- });
- }
- };
-
protected ConversationActivity activity = this;
private Toast prepareImageToast;
@@ -602,7 +577,7 @@ public class ConversationActivity extends XmppActivity {
this.onBackendConnected();
}
if (conversationList.size() >= 1) {
- onConvChanged.onConversationUpdate();
+ this.onConversationUpdate();
}
}
@@ -610,6 +585,8 @@ public class ConversationActivity extends XmppActivity {
protected void onStop() {
if (xmppConnectionServiceBound) {
xmppConnectionService.removeOnConversationListChangedListener();
+ xmppConnectionService.removeOnAccountListChangedListener();
+ xmppConnectionService.removeOnRosterUpdateListener();
}
super.onStop();
}
@@ -672,8 +649,9 @@ public class ConversationActivity extends XmppActivity {
public void registerListener() {
if (xmppConnectionServiceBound) {
- xmppConnectionService
- .setOnConversationListChangedListener(this.onConvChanged);
+ xmppConnectionService.setOnConversationListChangedListener(this);
+ xmppConnectionService.setOnAccountListChangedListener(this);
+ xmppConnectionService.setOnRosterUpdateListener(this);
}
}
@@ -806,7 +784,65 @@ public class ConversationActivity extends XmppActivity {
}
public boolean forceEncryption() {
- return PreferenceManager.getDefaultSharedPreferences(
- getApplicationContext()).getBoolean("force_encryption", false);
+ return getPreferences().getBoolean("force_encryption", false);
+ }
+
+ public boolean useSendButtonToIndicateStatus() {
+ return getPreferences().getBoolean("send_button_status", false);
+ }
+
+ @Override
+ public void onAccountUpdate() {
+ final ConversationFragment fragment = (ConversationFragment) getFragmentManager()
+ .findFragmentByTag("conversation");
+ if (fragment != null) {
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ fragment.updateMessages();
+ }
+ });
+ }
+ }
+
+ @Override
+ public void onConversationUpdate() {
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ updateConversationList();
+ if (paneShouldBeOpen) {
+ if (conversationList.size() >= 1) {
+ swapConversationFragment();
+ } else {
+ startActivity(new Intent(getApplicationContext(),
+ StartConversationActivity.class));
+ finish();
+ }
+ }
+ ConversationFragment selectedFragment = (ConversationFragment) getFragmentManager()
+ .findFragmentByTag("conversation");
+ if (selectedFragment != null) {
+ selectedFragment.updateMessages();
+ }
+ }
+ });
+ }
+
+ @Override
+ public void onRosterUpdate() {
+ final ConversationFragment fragment = (ConversationFragment) getFragmentManager()
+ .findFragmentByTag("conversation");
+ if (fragment != null) {
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ fragment.updateMessages();
+ }
+ });
+ }
}
}
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java
index b73bcadbe..c6b129ad7 100644
--- a/src/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/eu/siacs/conversations/ui/ConversationFragment.java
@@ -12,6 +12,7 @@ import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.entities.MucOptions;
+import eu.siacs.conversations.entities.Presences;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.EditMessage.OnEnterPressed;
import eu.siacs.conversations.ui.XmppActivity.OnPresenceSelected;
@@ -61,6 +62,7 @@ public class ConversationFragment extends Fragment {
protected String queuedPqpMessage = null;
private EditMessage mEditMessage;
+ private ImageButton mSendButton;
private String pastedText = null;
private RelativeLayout snackbar;
private TextView snackbarMessage;
@@ -255,9 +257,8 @@ public class ConversationFragment extends Fragment {
}
});
- ImageButton sendButton = (ImageButton) view
- .findViewById(R.id.textSendButton);
- sendButton.setOnClickListener(this.mSendButtonListener);
+ mSendButton = (ImageButton) view.findViewById(R.id.textSendButton);
+ mSendButton.setOnClickListener(this.mSendButtonListener);
snackbar = (RelativeLayout) view.findViewById(R.id.snackbar);
snackbarMessage = (TextView) view.findViewById(R.id.snackbar_message);
@@ -485,6 +486,7 @@ public class ConversationFragment extends Fragment {
activity.getConversationList(), null, false);
activity.updateConversationList();
}
+ this.updateSendButton();
}
}
@@ -497,6 +499,51 @@ public class ConversationFragment extends Fragment {
updateChatMsgHint();
}
+ public void updateSendButton() {
+ Conversation c = this.conversation;
+ if (activity.useSendButtonToIndicateStatus() && c != null
+ && c.getAccount().getStatus() == Account.STATUS_ONLINE) {
+ if (c.getMode() == Conversation.MODE_SINGLE) {
+ switch (c.getContact().getMostAvailableStatus()) {
+ case Presences.ONLINE:
+ this.mSendButton
+ .setImageResource(R.drawable.ic_action_send_now_online);
+ break;
+ case Presences.AWAY:
+ this.mSendButton
+ .setImageResource(R.drawable.ic_action_send_now_away);
+ break;
+ case Presences.XA:
+ this.mSendButton
+ .setImageResource(R.drawable.ic_action_send_now_away);
+ break;
+ case Presences.DND:
+ this.mSendButton
+ .setImageResource(R.drawable.ic_action_send_now_dnd);
+ break;
+ default:
+ this.mSendButton
+ .setImageResource(R.drawable.ic_action_send_now_offline);
+ break;
+ }
+ } else if (c.getMode() == Conversation.MODE_MULTI) {
+ if (c.getMucOptions().online()) {
+ this.mSendButton
+ .setImageResource(R.drawable.ic_action_send_now_online);
+ } else {
+ this.mSendButton
+ .setImageResource(R.drawable.ic_action_send_now_offline);
+ }
+ } else {
+ this.mSendButton
+ .setImageResource(R.drawable.ic_action_send_now_offline);
+ }
+ } else {
+ this.mSendButton
+ .setImageResource(R.drawable.ic_action_send_now_offline);
+ }
+ }
+
protected void updateStatusMessages() {
if (conversation.getMode() == Conversation.MODE_SINGLE) {
for (int i = this.messageList.size() - 1; i >= 0; --i) {