Skip to content

Commit

Permalink
Modern-style Android chat icons (incl. secure icon)
Browse files Browse the repository at this point in the history
Make the send-button appearance more similar to the default Android
messenger application
  • Loading branch information
mcginty authored and moxie0 committed Mar 10, 2013
1 parent b05c840 commit 674cd68
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 62 deletions.
Binary file added artwork/ic_send_holo_light_encrypted.psd
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/ic_send_holo_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/ic_send_holo_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/ic_send_holo_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions res/drawable/send_button_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- pressed -->
<item android:state_pressed="true" >
<shape>
<solid android:color="#FF33B5E5" />
</shape>
</item>

<!-- focused -->
<item android:state_focused="true" >
<shape>
<solid android:color="#FF33B5E5" />
</shape>
</item>

<!-- default -->
<item>
<shape>
<solid android:color="#00ffffff" />
</shape>
</item>

</selector>
54 changes: 29 additions & 25 deletions res/layout/conversation_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,42 +74,46 @@
android:layout_width="match_parent"
android:layout_height="1dp" />


<LinearLayout
android:id="@+id/bottom_panel"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="5dip"
android:orientation="horizontal"
android:paddingLeft="5dip"
android:paddingRight="5dip"
>
android:paddingRight="0dp"
android:paddingTop="0dp" >

<EditText
android:id="@+id/embedded_text_editor"
android:textColor="@android:color/black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:autoText="true"
android:capitalize="sentences"
android:nextFocusRight="@+id/send_button"
android:hint="@string/conversation_activity__type_message"
android:maxLines="4"
android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
android:imeOptions="actionSend|flagNoEnterAction"
android:maxLength="1000"
/>

<Button android:id="@+id/send_button"
android:layout_marginLeft="5dip"
android:id="@+id/embedded_text_editor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:layout_weight="1.0"
android:autoText="true"
android:capitalize="sentences"
android:hint="@string/conversation_activity__type_message"
android:imeOptions="actionSend|flagNoEnterAction"
android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
android:maxLength="1000"
android:maxLines="4"
android:nextFocusRight="@+id/send_button"
android:textColor="@android:color/black" />

<ImageButton
android:id="@+id/send_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:background="@drawable/send_button_background"
android:contentDescription="@string/conversation_activity__send"
android:nextFocusLeft="@+id/embedded_text_editor"
android:text="@string/conversation_activity__send"
android:padding="8dip"
/>
android:padding="12dp"
android:src="@drawable/ic_send_holo_light"
android:clickable="false"
android:enabled="false"
android:tint="#66ffffff" />

"
</LinearLayout>
<TextView android:id="@+id/space_left"
android:paddingLeft="5dip"
Expand Down
81 changes: 44 additions & 37 deletions src/org/thoughtcrime/securesms/ConversationActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,9 @@
*/
package org.thoughtcrime.securesms;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.telephony.PhoneNumberUtils;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.ContextMenu;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnKeyListener;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;

import org.thoughtcrime.securesms.components.RecipientsPanel;
import org.thoughtcrime.securesms.crypto.AuthenticityCalculator;
Expand Down Expand Up @@ -75,15 +50,38 @@
import org.thoughtcrime.securesms.util.Util;

import ws.com.google.android.mms.MmsException;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.telephony.PhoneNumberUtils;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.ContextMenu;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnKeyListener;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;

import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;

import java.io.IOException;
import java.util.LinkedList;
import java.util.List;

/**
* Activity for displaying a message thread, as well as
* composing/sending a new message into that thread.
Expand Down Expand Up @@ -111,7 +109,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
private RecipientsPanel recipientsPanel;
private EditText composeText;
private ImageButton addContactButton;
private Button sendButton;
private ImageButton sendButton;
private TextView charactersLeft;

private AttachmentTypeSelectorAdapter attachmentAdapter;
Expand Down Expand Up @@ -466,12 +464,11 @@ private void initializeSecurity() {
if (isSingleConversation() &&
KeyUtil.isSessionFor(this, getRecipients().getPrimaryRecipient()))
{
sendButton.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_menu_lock_holo_light, 0);
sendButton.setCompoundDrawablePadding(15);
sendButton.setImageResource(R.drawable.ic_send_encrypted_holo_light);
this.isEncryptedConversation = true;
this.characterCalculator = new EncryptedCharacterCalculator();
} else {
sendButton.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
sendButton.setImageResource(R.drawable.ic_send_holo_light);
this.isEncryptedConversation = false;
this.characterCalculator = new CharacterCalculator();
}
Expand All @@ -498,7 +495,7 @@ private void initializeResources() {
recipients = getIntent().getParcelableExtra("recipients");
threadId = getIntent().getLongExtra("thread_id", -1);
addContactButton = (ImageButton)findViewById(R.id.contacts_button);
sendButton = (Button)findViewById(R.id.send_button);
sendButton = (ImageButton)findViewById(R.id.send_button);
composeText = (EditText)findViewById(R.id.embedded_text_editor);
masterSecret = (MasterSecret)getIntent().getParcelableExtra("master_secret");
charactersLeft = (TextView)findViewById(R.id.space_left);
Expand All @@ -510,6 +507,7 @@ private void initializeResources() {

recipientsPanel.setPanelChangeListener(new RecipientsPanelChangeListener());
sendButton.setOnClickListener(sendButtonListener);
sendButton.setEnabled(false);
addContactButton.setOnClickListener(new AddRecipientButtonListener());
composeText.setOnKeyListener(new ComposeKeyPressedListener());
composeText.addTextChangedListener(new OnTextChangedListener());
Expand Down Expand Up @@ -820,6 +818,15 @@ private class OnTextChangedListener implements TextWatcher {
@Override
public void afterTextChanged(Editable s) {
calculateCharactersRemaining();
if (s == null || s.length() == 0) {
sendButton.setClickable(false);
sendButton.setEnabled(false);
sendButton.setColorFilter(0x66FFFFFF);
} else {
sendButton.setClickable(true);
sendButton.setEnabled(true);
sendButton.setColorFilter(null);
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,int after) {}
Expand Down

0 comments on commit 674cd68

Please sign in to comment.