diff --git a/res/values/strings.xml b/res/values/strings.xml
index ff4261416d..c19e489e75 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1550,5 +1550,8 @@
You\'ve sent %1$s a friend request
%1$s accepted your friend request
Your friend request to %1$s has expired
+
+ Pending Friend Request…
+ New Message
diff --git a/src/org/thoughtcrime/securesms/components/ComposeText.java b/src/org/thoughtcrime/securesms/components/ComposeText.java
index bf592e347c..9f26a9f904 100644
--- a/src/org/thoughtcrime/securesms/components/ComposeText.java
+++ b/src/org/thoughtcrime/securesms/components/ComposeText.java
@@ -11,7 +11,6 @@ import android.support.v13.view.inputmethod.EditorInfoCompat;
import android.support.v13.view.inputmethod.InputConnectionCompat;
import android.support.v13.view.inputmethod.InputContentInfoCompat;
import android.support.v4.os.BuildCompat;
-import android.text.Editable;
import android.text.InputType;
import android.text.Spannable;
import android.text.SpannableString;
@@ -20,13 +19,12 @@ import android.text.TextUtils;
import android.text.TextUtils.TruncateAt;
import android.text.style.RelativeSizeSpan;
import android.util.AttributeSet;
-import org.thoughtcrime.securesms.logging.Log;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
-import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.TransportOption;
import org.thoughtcrime.securesms.components.emoji.EmojiEditText;
+import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
public class ComposeText extends EmojiEditText {
@@ -139,10 +137,12 @@ public class ComposeText extends EmojiEditText {
setInputType(inputType);
setImeOptions(imeOptions);
+ /*
setHint(transport.getComposeHint(),
transport.getSimName().isPresent()
? getContext().getString(R.string.conversation_activity__from_sim_name, transport.getSimName().get())
: null);
+ */
}
@Override
diff --git a/src/org/thoughtcrime/securesms/components/InputPanel.java b/src/org/thoughtcrime/securesms/components/InputPanel.java
index 6f3d9ddd01..be54864d4b 100644
--- a/src/org/thoughtcrime/securesms/components/InputPanel.java
+++ b/src/org/thoughtcrime/securesms/components/InputPanel.java
@@ -255,6 +255,10 @@ public class InputPanel extends LinearLayout
quickCameraToggle.setEnabled(enabled);
}
+ public void setHint(@NonNull String hint) {
+ composeText.setHint(hint, null);
+ }
+
private long onRecordHideEvent() {
recordLockCancel.setVisibility(View.GONE);
diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java
index 711caea1d7..82829a45cd 100644
--- a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java
+++ b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java
@@ -426,6 +426,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
MessageNotifier.setVisibleThread(threadId);
markThreadAsRead();
+ updateInputPanel();
+
Log.i(TAG, "onResume() Finished: " + (System.currentTimeMillis() - getIntent().getLongExtra(TIMING_EXTRA, 0)));
}
@@ -2002,6 +2004,15 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
attachmentManager.cleanup();
updateLinkPreviewState();
+
+ updateInputPanel();
+ }
+
+ private void updateInputPanel() {
+ boolean hasPendingFriendRequest = DatabaseFactory.getLokiThreadFriendRequestDatabase(this).hasPendingFriendRequest(threadId);
+ inputPanel.setEnabled(!hasPendingFriendRequest);
+ int hintID = hasPendingFriendRequest ? R.string.activity_conversation_pending_friend_request_hint : R.string.activity_conversation_default_hint;
+ inputPanel.setHint(getResources().getString(hintID));
}
private void sendMessage() {
@@ -2154,7 +2165,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
message = new OutgoingTextMessage(recipient, messageBody, expiresIn, subscriptionId);
}
- // Loki - Always send friend requests if we're not friends with the user
+ // Loki - Always send a friend request if we're not yet friends with the user
LokiThreadFriendRequestStatus friendRequestStatus = DatabaseFactory.getLokiThreadFriendRequestDatabase(context).getFriendRequestStatus(threadId);
message.isFriendRequest = (friendRequestStatus != LokiThreadFriendRequestStatus.FRIENDS);
diff --git a/src/org/thoughtcrime/securesms/loki/LokiThreadFriendRequestDatabase.kt b/src/org/thoughtcrime/securesms/loki/LokiThreadFriendRequestDatabase.kt
index ffdcb52c27..ea2d21e671 100644
--- a/src/org/thoughtcrime/securesms/loki/LokiThreadFriendRequestDatabase.kt
+++ b/src/org/thoughtcrime/securesms/loki/LokiThreadFriendRequestDatabase.kt
@@ -41,4 +41,10 @@ class LokiThreadFriendRequestDatabase(context: Context, helper: SQLCipherOpenHel
database.insertOrUpdate(tableName, contentValues, "${Companion.threadID} = ?", arrayOf( threadID.toString() ))
notifyConversationListListeners()
}
+
+ fun hasPendingFriendRequest(threadID: Long): Boolean {
+ val friendRequestStatus = getFriendRequestStatus(threadID)
+ return friendRequestStatus == LokiThreadFriendRequestStatus.REQUEST_SENDING || friendRequestStatus == LokiThreadFriendRequestStatus.REQUEST_SENT
+ || friendRequestStatus == LokiThreadFriendRequestStatus.REQUEST_RECEIVED
+ }
}
\ No newline at end of file