Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
am c7c68db: Remove smiley support
Browse files Browse the repository at this point in the history
* commit 'c7c68dba4f3440f234f65eef579f9aaa82682f8c':
  Remove smiley support
  • Loading branch information
Tom Taylor authored and Android Git Automerger committed Oct 1, 2013
2 parents a2bbbfc + c7c68db commit b2b4d1a
Show file tree
Hide file tree
Showing 13 changed files with 6 additions and 513 deletions.
Binary file removed res/drawable-hdpi/ic_menu_emoticons.png
Binary file not shown.
Binary file removed res/drawable-mdpi/ic_menu_emoticons.png
Binary file not shown.
Binary file removed res/drawable-xhdpi/ic_menu_emoticons.png
Binary file not shown.
47 changes: 0 additions & 47 deletions res/layout/smiley_menu_item.xml

This file was deleted.

54 changes: 0 additions & 54 deletions res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,60 +16,6 @@
* limitations under the License.
-->
<resources>
<!-- NOTE: if you change anything about this array, you must make the corresponding change
to the array DEFAULT_SMILEY_RES_IDS in MessageListItem.java and to default_smiley_names
below. -->
<string-array name="default_smiley_texts" translatable="false">
<item>:-)</item> <!-- 0: Happy -->
<item>:-(</item> <!-- 1: Sad -->
<item>;-)</item> <!-- 2: Winking -->
<item>:-P</item> <!-- 3: Tongue sticking out -->
<item>=-O</item> <!-- 4: Surprised -->
<item>:-*</item> <!-- 5: Kissing -->
<item>:O</item> <!-- 6: Yelling -->
<item>B-)</item> <!-- 7: Cool -->
<item>:-$</item> <!-- 8: Money mouth -->
<item>:-!</item> <!-- 9: Foot in mouth -->
<item>:-[</item> <!-- 10: Embarrassed -->
<item>O:-)</item> <!-- 11: Angel -->
<item>:-\\</item> <!-- 12: Undecided -->
<item>:\'(</item> <!-- 13: Crying -->
<item>:-X</item> <!-- 14: Lips are sealed -->
<item>:-D</item> <!-- 15: Laughing -->
<item>o_O</item> <!-- 16: Confused -->
<item>&lt;3</item> <!-- 17: Heart -->
<item>x-(</item> <!-- 18: Mad -->
<item>:-/</item> <!-- 19: Smirk -->
<item>:-I</item> <!-- 20: Poker face -->
</string-array>

<!-- NOTE: if you change anything about this array, you must make the corresponding change
to the array DEFAULT_SMILEY_RES_IDS in SmileyParser.java and to default_smiley_texts
above. -->
<string-array name="default_smiley_names">
<item>Happy</item> <!-- 0: :-) -->
<item>Sad</item> <!-- 1: :-( -->
<item>Winking</item> <!-- 2: ;-) -->
<item>Tongue sticking out</item> <!-- 3: :-P -->
<item>Surprised</item> <!-- 4: =-O -->
<item>Kissing</item> <!-- 5: :-* -->
<item>Yelling</item> <!-- 6: :O -->
<item>Cool</item> <!-- 7: B-) -->
<item>Money mouth</item> <!-- 8: :-$ -->
<item>Foot in mouth</item> <!-- 9: :-! -->
<item>Embarrassed</item> <!-- 10: :-[ -->
<item>Angel</item> <!-- 11: O:-) -->
<item>Undecided</item> <!-- 12: :-\\ -->
<item>Crying</item> <!-- 13: :\'( -->
<item>Lips are sealed</item> <!-- 14: :-X -->
<item>Laughing</item> <!-- 15: :-D -->
<item>Confused</item> <!-- 16: o_O -->
<item>Heart</item> <!-- 17: <3 -->
<item>Mad</item> <!-- 18: x-( -->
<item>Smirk</item> <!-- 19: :-/ -->
<item>Poker face</item> <!-- 20: :-I -->
</string-array>

<!-- String to match as no subject and filter out as a subject. For example, if the
subject string is "no subject", we won't display that. We'll pretend
no subject string was delivered. -->
Expand Down
3 changes: 1 addition & 2 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<!-- Menu item in slideshow edit screen for moving the selected slide down in the order -->
<string name="move_down">Move down</string>
<!-- Menu item in slideshow edit screen for removing the selected slide from the slideshow -->
<string name="remove_slide">Remove slide</string>
<string name="remove_slide">Remove slide</string>
<!-- Menu item in slideshow edit screen for adding a new slide to the slideshow -->
<string name="add_slide">Add slide</string>
<!-- Text displayed below "Add slide" item in slideshow edit screen -->
Expand Down Expand Up @@ -622,7 +622,6 @@
<!-- Toast message on failed copying ringtone to drm provider -->
<string name="saved_ringtone_fail">Couldn\'t save ringtone.</string>
<!-- Menu item -->
<string name="menu_insert_smiley">Insert smiley</string>
<!-- Menu item [CHAR LIMIT=40] -->
<string name="menu_group_participants">Group participants</string>

Expand Down
2 changes: 0 additions & 2 deletions src/com/android/mms/MmsApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import com.android.mms.util.DraftCache;
import com.android.mms.util.PduLoaderManager;
import com.android.mms.util.RateController;
import com.android.mms.util.SmileyParser;
import com.android.mms.util.ThumbnailManager;

public class MmsApp extends Application {
Expand Down Expand Up @@ -96,7 +95,6 @@ public synchronized void onCountryDetected(Country country) {
DownloadManager.init(this);
RateController.init(this);
LayoutManager.init(this);
SmileyParser.init(this);
MessagingNotification.init(this);

activePendingMessages();
Expand Down
91 changes: 0 additions & 91 deletions src/com/android/mms/ui/ComposeMessageActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@
import com.android.mms.util.DraftCache;
import com.android.mms.util.PhoneNumberFormatter;
import com.android.mms.util.SendingProgressTokenManager;
import com.android.mms.util.SmileyParser;
import com.android.mms.widget.MmsWidgetProvider;
import com.google.android.mms.ContentType;
import com.google.android.mms.MmsException;
Expand Down Expand Up @@ -209,7 +208,6 @@ public class ComposeMessageActivity extends Activity
private static final int MENU_SEND_EMAIL = 23;
private static final int MENU_COPY_MESSAGE_TEXT = 24;
private static final int MENU_COPY_TO_SDCARD = 25;
private static final int MENU_INSERT_SMILEY = 26;
private static final int MENU_ADD_ADDRESS_TO_CONTACTS = 27;
private static final int MENU_LOCK_MESSAGE = 28;
private static final int MENU_UNLOCK_MESSAGE = 29;
Expand Down Expand Up @@ -298,8 +296,6 @@ public class ComposeMessageActivity extends Activity

private WorkingMessage mWorkingMessage; // The message currently being composed.

private AlertDialog mSmileyDialog;

private boolean mWaitingForSubActivity;
private int mLastRecipientCount; // Used for warning the user on too many recipients.
private AttachmentTypeSelectorAdapter mAttachmentTypeSelectorAdapter;
Expand Down Expand Up @@ -2666,11 +2662,6 @@ public boolean onPrepareOptionsMenu(Menu menu) {
menu.add(0, MENU_SEND, 0, R.string.send).setIcon(android.R.drawable.ic_menu_send);
}

if (!mWorkingMessage.hasSlideshow() && mIsSmsEnabled) {
menu.add(0, MENU_INSERT_SMILEY, 0, R.string.menu_insert_smiley).setIcon(
R.drawable.ic_menu_emoticons);
}

if (getRecipients().size() > 1) {
menu.add(0, MENU_GROUP_PARTICIPANTS, 0, R.string.menu_group_participants);
}
Expand Down Expand Up @@ -2761,9 +2752,6 @@ public void run() {
case MENU_CALL_RECIPIENT:
dialRecipient();
break;
case MENU_INSERT_SMILEY:
showSmileyDialog();
break;
case MENU_GROUP_PARTICIPANTS:
{
Intent intent = new Intent(this, RecipientListActivity.class);
Expand Down Expand Up @@ -4276,85 +4264,6 @@ protected void onDeleteComplete(int token, Object cookie, int result) {
}
}

private void showSmileyDialog() {
if (mSmileyDialog == null) {
int[] icons = SmileyParser.DEFAULT_SMILEY_RES_IDS;
String[] names = getResources().getStringArray(
SmileyParser.DEFAULT_SMILEY_NAMES);
final String[] texts = getResources().getStringArray(
SmileyParser.DEFAULT_SMILEY_TEXTS);

final int N = names.length;

List<Map<String, ?>> entries = new ArrayList<Map<String, ?>>();
for (int i = 0; i < N; i++) {
// We might have different ASCII for the same icon, skip it if
// the icon is already added.
boolean added = false;
for (int j = 0; j < i; j++) {
if (icons[i] == icons[j]) {
added = true;
break;
}
}
if (!added) {
HashMap<String, Object> entry = new HashMap<String, Object>();

entry. put("icon", icons[i]);
entry. put("name", names[i]);
entry.put("text", texts[i]);

entries.add(entry);
}
}

final SimpleAdapter a = new SimpleAdapter(
this,
entries,
R.layout.smiley_menu_item,
new String[] {"icon", "name", "text"},
new int[] {R.id.smiley_icon, R.id.smiley_name, R.id.smiley_text});
SimpleAdapter.ViewBinder viewBinder = new SimpleAdapter.ViewBinder() {
@Override
public boolean setViewValue(View view, Object data, String textRepresentation) {
if (view instanceof ImageView) {
Drawable img = getResources().getDrawable((Integer)data);
((ImageView)view).setImageDrawable(img);
return true;
}
return false;
}
};
a.setViewBinder(viewBinder);

AlertDialog.Builder b = new AlertDialog.Builder(this);

b.setTitle(getString(R.string.menu_insert_smiley));

b.setCancelable(true);
b.setAdapter(a, new DialogInterface.OnClickListener() {
@Override
@SuppressWarnings("unchecked")
public final void onClick(DialogInterface dialog, int which) {
HashMap<String, Object> item = (HashMap<String, Object>) a.getItem(which);

String smiley = (String)item.get("text");
if (mSubjectTextEditor != null && mSubjectTextEditor.hasFocus()) {
mSubjectTextEditor.append(smiley);
} else {
mTextEditor.append(smiley);
}

dialog.dismiss();
}
});

mSmileyDialog = b.create();
}

mSmileyDialog.show();
}

@Override
public void onUpdate(final Contact updated) {
// Using an existing handler for the post, rather than conjuring up a new one.
Expand Down
4 changes: 1 addition & 3 deletions src/com/android/mms/ui/ConversationListItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import com.android.mms.data.Contact;
import com.android.mms.data.ContactList;
import com.android.mms.data.Conversation;
import com.android.mms.util.SmileyParser;

/**
* This class manages the view for given conversation.
Expand Down Expand Up @@ -209,8 +208,7 @@ public final void bind(Context context, final Conversation conversation) {
Contact.addListener(this);

// Subject
SmileyParser parser = SmileyParser.getInstance();
mSubjectView.setText(parser.addSmileySpans(conversation.getSnippet()));
mSubjectView.setText(conversation.getSnippet());
LayoutParams subjectLayout = (LayoutParams)mSubjectView.getLayoutParams();
// We have to make the subject left of whatever optional items are shown on the right.
subjectLayout.addRule(RelativeLayout.LEFT_OF, hasAttachment ? R.id.attachment :
Expand Down
13 changes: 3 additions & 10 deletions src/com/android/mms/ui/MessageListItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
import com.android.mms.transaction.TransactionService;
import com.android.mms.util.DownloadManager;
import com.android.mms.util.ItemLoadedCallback;
import com.android.mms.util.SmileyParser;
import com.android.mms.util.ThumbnailManager.ImageLoaded;
import com.google.android.mms.ContentType;
import com.google.android.mms.pdu.PduHeaders;
Expand Down Expand Up @@ -347,7 +346,7 @@ private void bindCommonMessage(final boolean sameItem) {
if (mMessageItem.mSlideshow == null) {
debugText = "NULL slideshow";
} else {
SlideModel slide = ((SlideshowModel) mMessageItem.mSlideshow).get(0);
SlideModel slide = mMessageItem.mSlideshow.get(0);
if (slide == null) {
debugText = "NULL first slide";
} else if (!slide.hasImage()) {
Expand Down Expand Up @@ -533,14 +532,8 @@ private CharSequence formatMessage(MessageItem msgItem, String body,
SpannableStringBuilder buf = new SpannableStringBuilder();

boolean hasSubject = !TextUtils.isEmpty(subject);
SmileyParser parser = SmileyParser.getInstance();
if (hasSubject) {
CharSequence smilizedSubject = parser.addSmileySpans(subject);
// Can't use the normal getString() with extra arguments for string replacement
// because it doesn't preserve the SpannableText returned by addSmileySpans.
// We have to manually replace the %s with our text.
buf.append(TextUtils.replace(mContext.getResources().getString(R.string.inline_subject),
new String[] { "%s" }, new CharSequence[] { smilizedSubject }));
buf.append(mContext.getResources().getString(R.string.inline_subject, subject));
}

if (!TextUtils.isEmpty(body)) {
Expand All @@ -552,7 +545,7 @@ private CharSequence formatMessage(MessageItem msgItem, String body,
if (hasSubject) {
buf.append(" - ");
}
buf.append(parser.addSmileySpans(body));
buf.append(body);
}
}

Expand Down
Loading

0 comments on commit b2b4d1a

Please sign in to comment.