@ -2124,21 +2124,30 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
updateLinkPreviewState ( ) ;
updateLinkPreviewState ( ) ;
}
}
@Override
@Override
public void handleThreadFriendRequestStatusChanged ( long threadID ) {
public void handleThreadFriendRequestStatusChanged ( long threadID ) {
if ( threadID ! = this . threadId ) { return ; }
if ( threadID ! = this . threadId ) { return ; }
new Handler ( getMainLooper ( ) ) . post ( this : : updateInputPanel ) ;
new Handler ( getMainLooper ( ) ) . post ( this : : updateInputPanel ) ;
}
}
private void updateInputPanel ( ) {
private void updateInputPanel ( ) {
boolean hasPendingFriendRequest = DatabaseFactory . getLokiThreadDatabase ( this ) . hasPendingFriendRequest ( threadId ) ;
Recipient recipient = DatabaseFactory . getThreadDatabase ( this ) . getRecipientForThreadId ( threadId ) ;
inputPanel . setEnabled ( ! hasPendingFriendRequest ) ;
boolean isGroup = recipient . isGroupRecipient ( ) ;
int hintID = hasPendingFriendRequest ? R . string . activity_conversation_pending_friend_request_hint : R . string . activity_conversation_default_hint ;
if ( isGroup ) {
inputPanel . setHint ( getResources ( ) . getString ( hintID ) ) ;
boolean isRSSFeed = recipient . getName ( ) . equals ( "Loki News" ) | | recipient . getName ( ) . equals ( "Loki Messenger Updates" ) ; // TODO: This is just a temporary hack and should be removed ASAP
if ( ! hasPendingFriendRequest ) {
inputPanel . setEnabled ( ! isRSSFeed ) ;
inputPanel . composeText . requestFocus ( ) ;
String hint = isRSSFeed ? "Input disabled" : "New Message" ;
InputMethodManager inputMethodManager = ( InputMethodManager ) getSystemService ( INPUT_METHOD_SERVICE ) ;
inputPanel . setHint ( hint ) ;
inputMethodManager . showSoftInput ( inputPanel . composeText , 0 ) ;
} else {
boolean hasPendingFriendRequest = DatabaseFactory . getLokiThreadDatabase ( 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 ) ) ;
if ( ! hasPendingFriendRequest ) {
inputPanel . composeText . requestFocus ( ) ;
InputMethodManager inputMethodManager = ( InputMethodManager ) getSystemService ( INPUT_METHOD_SERVICE ) ;
inputMethodManager . showSoftInput ( inputPanel . composeText , 0 ) ;
}
}
}
}
}
@ -2189,8 +2198,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
Toast . LENGTH_LONG ) . show ( ) ;
Toast . LENGTH_LONG ) . show ( ) ;
Log . w ( TAG , ex ) ;
Log . w ( TAG , ex ) ;
} catch ( InvalidMessageException ex ) {
} catch ( InvalidMessageException ex ) {
Toast . makeText ( ConversationActivity . this , R . string . ConversationActivity_message_is_empty_exclamation ,
// Toast.makeText(ConversationActivity.this, R.string.ConversationActivity_message_is_empty_exclamation,
Toast . LENGTH_SHORT ) . show ( ) ;
// Toast.LENGTH_SHORT).show();
Log . w ( TAG , ex ) ;
Log . w ( TAG , ex ) ;
}
}
}
}