repurpose ImageDivet for avatar, minor lint, fix bitmap decoding
// FREEBIE
BIN
artwork/lower_right_divet_dark.psd
Normal file
BIN
artwork/lower_right_divet_light.psd
Normal file
Before Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 199 B |
BIN
res/drawable-hdpi/divet_lower_right_dark.png
Normal file
After Width: | Height: | Size: 1018 B |
BIN
res/drawable-hdpi/divet_lower_right_light.png
Normal file
After Width: | Height: | Size: 1021 B |
Before Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 617 B |
Before Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 147 B |
BIN
res/drawable-mdpi/divet_lower_right_dark.png
Normal file
After Width: | Height: | Size: 991 B |
BIN
res/drawable-mdpi/divet_lower_right_light.png
Normal file
After Width: | Height: | Size: 1000 B |
Before Width: | Height: | Size: 144 B |
Before Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 424 B |
Before Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 226 B |
BIN
res/drawable-xhdpi/divet_lower_right_dark.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
res/drawable-xhdpi/divet_lower_right_light.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 227 B |
Before Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 841 B |
BIN
res/drawable-xxhdpi/divet_lower_right_dark.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
res/drawable-xxhdpi/divet_lower_right_light.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
@ -20,12 +20,13 @@
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView android:id="@+id/avatar"
|
||||
<org.thoughtcrime.securesms.components.ImageDivet android:id="@+id/avatar"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
position="bottom_right"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@drawable/thin_border"
|
||||
android:src="@drawable/icon"/>
|
||||
android:src="@drawable/icon"
|
||||
android:contentDescription="@string/GroupCreateActivity_avatar_content_description" />
|
||||
|
||||
<EditText android:id="@+id/group_name"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -5,7 +5,7 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<ListView android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:fastScrollEnabled="true" />
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center|center_vertical"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/contact_selection_group_activity__no_contacts"
|
||||
android:text="@string/contact_selection_group_activity__finding_contacts"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:title="@string/contact_selection__menu_finished"
|
||||
android:id="@+id/menu_selection_finished"
|
||||
android:icon="@drawable/ic_menu_done_holo_dark"
|
||||
android:icon="?menu_accept_icon"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:title="CREATE"
|
||||
<item android:title="@string/GroupCreateActivity_menu_create_title"
|
||||
android:id="@+id/menu_create_group"
|
||||
android:icon="@drawable/ic_menu_accept_holo_light"
|
||||
android:icon="?menu_accept_icon"
|
||||
android:showAsAction="always|withText"/>
|
||||
|
||||
</menu>
|
@ -17,10 +17,9 @@
|
||||
<attr name="conversation_received_text_secondary_color" format="reference|color"/>
|
||||
|
||||
<attr name="actionbar_icon" format="reference" />
|
||||
<attr name="lower_right_divet" format="reference" />
|
||||
|
||||
<attr name="conversation_background" format="reference|color"/>
|
||||
<attr name="conversation_avatar_divet_right" format="reference"/>
|
||||
<attr name="conversation_avatar_divet_left" format="reference"/>
|
||||
<attr name="conversation_editor_background" format="reference|color"/>
|
||||
<attr name="conversation_editor_text_color" format="reference|color"/>
|
||||
<attr name="conversation_send_button" format="reference"/>
|
||||
@ -45,4 +44,5 @@
|
||||
<attr name="menu_selectall_icon" format="reference" />
|
||||
<attr name="menu_group_icon" format="reference" />
|
||||
<attr name="menu_split_icon" format="reference" />
|
||||
<attr name="menu_accept_icon" format="reference" />
|
||||
</resources>
|
@ -48,7 +48,10 @@
|
||||
<string name="ConversationItem_received_and_processed_key_exchange_message">Received and processed key exchange message.</string>
|
||||
<string name="ConversationItem_error_received_stale_key_exchange_message">Error, received stale key exchange message.</string>
|
||||
<string name="ConversationItem_received_key_exchange_message_click_to_process">Received key exchange message, click to process.</string>
|
||||
|
||||
<string name="ConversationItem_group_action_left">%1$s has left the group.</string>
|
||||
<string name="ConversationItem_group_action_joined">%1$s have joined the group.</string>
|
||||
<string name="ConversationItem_group_action_modify">%1$s has updated the group.</string>
|
||||
|
||||
<!-- ConversationActivity -->
|
||||
<string name="ConversationActivity_initiate_secure_session_question">Initiate Secure Session?</string>
|
||||
<string name="ConversationActivity_initiate_secure_session_with_s_question">Initiate secure session with %s?</string>
|
||||
@ -128,6 +131,9 @@
|
||||
<string name="GroupCreateActivity_contacts_no_members">You need at least one person in your group!</string>
|
||||
<string name="GroupCreateActivity_contacts_invalid_number">One of the members of your group has a number that can\'t be read correctly. Please fix or remove that contact and try again.</string>
|
||||
<string name="GroupCreateActivity_file_io_exception">File I/O error, couldn\'t create a temporary image file.</string>
|
||||
<string name="GroupCreateActivity_avatar_content_description">Group Avatar</string>
|
||||
<string name="GroupCreateActivity_menu_create_title">Create Group</string>
|
||||
<string name="GroupCreateActivity_creating_group">Creating %1$s…</string>
|
||||
|
||||
<!-- ImportFragment -->
|
||||
<string name="ImportFragment_import_system_sms_database">Import System SMS Database?</string>
|
||||
|
@ -10,6 +10,7 @@
|
||||
<item name="conversation_list_item_date_color">#ff999999</item>
|
||||
|
||||
<item name="actionbar_icon">@drawable/actionbar_icon_holo_light</item>
|
||||
<item name="lower_right_divet">@drawable/divet_lower_right_dark</item>
|
||||
|
||||
<item name="conversation_group_member_name">#99000000</item>
|
||||
<item name="conversation_sent_text_primary_color">#ffeeeeee</item>
|
||||
@ -18,8 +19,6 @@
|
||||
<item name="conversation_received_text_secondary_color">#33000000</item>
|
||||
|
||||
<item name="conversation_background">#ffdddddd</item>
|
||||
<item name="conversation_avatar_divet_right">@drawable/divet_right_light</item>
|
||||
<item name="conversation_avatar_divet_left">@drawable/divet_left_light</item>
|
||||
<item name="conversation_editor_background">#eeeeee</item>
|
||||
<item name="conversation_editor_text_color">@color/edit_text_light_theme</item>
|
||||
<item name="conversation_send_button">@drawable/ic_send_holo_light</item>
|
||||
@ -39,6 +38,7 @@
|
||||
<item name="menu_trash_icon">@drawable/ic_menu_trash_holo_light</item>
|
||||
<item name="menu_selectall_icon">@drawable/ic_menu_selectall_holo_light</item>
|
||||
<item name="menu_split_icon">@drawable/ic_menu_split_holo_light</item>
|
||||
<item name="menu_accept_icon">@drawable/ic_menu_accept_holo_light</item>
|
||||
|
||||
</style>
|
||||
|
||||
@ -69,10 +69,9 @@
|
||||
<item name="conversation_received_text_secondary_color">#33000000</item>
|
||||
|
||||
<item name="actionbar_icon">@drawable/actionbar_icon_holo_dark</item>
|
||||
<item name="lower_right_divet">@drawable/divet_lower_right_light</item>
|
||||
|
||||
<item name="conversation_background">@color/black</item>
|
||||
<item name="conversation_avatar_divet_right">@drawable/divet_right_dark</item>
|
||||
<item name="conversation_avatar_divet_left">@drawable/divet_left_dark</item>
|
||||
<item name="conversation_editor_background">@color/black</item>
|
||||
<item name="conversation_editor_text_color">@color/edit_text_dark_theme</item>
|
||||
<item name="conversation_send_button">@drawable/ic_send_holo_dark</item>
|
||||
@ -91,6 +90,7 @@
|
||||
<item name="menu_trash_icon">@drawable/ic_menu_trash_holo_dark</item>
|
||||
<item name="menu_selectall_icon">@drawable/ic_menu_selectall_holo_dark</item>
|
||||
<item name="menu_split_icon">@drawable/ic_menu_split_holo_dark</item>
|
||||
<item name="menu_accept_icon">@drawable/ic_menu_accept_holo_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="TextSecure.DarkTheme.NavigationDrawer"
|
||||
|
@ -25,7 +25,6 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
@ -61,7 +60,6 @@ import org.thoughtcrime.securesms.components.EmojiToggle;
|
||||
import org.thoughtcrime.securesms.components.RecipientsPanel;
|
||||
import org.thoughtcrime.securesms.contacts.ContactAccessor;
|
||||
import org.thoughtcrime.securesms.contacts.ContactAccessor.ContactData;
|
||||
import org.thoughtcrime.securesms.contacts.ContactPhotoFactory;
|
||||
import org.thoughtcrime.securesms.crypto.KeyExchangeInitiator;
|
||||
import org.thoughtcrime.securesms.crypto.KeyExchangeProcessor;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
@ -496,7 +494,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
||||
title = (!TextUtils.isEmpty(groupName)) ? groupName : getString(R.string.ConversationActivity_unnamed_group);
|
||||
final Bitmap avatar = getRecipients().getPrimaryRecipient().getContactPhoto();
|
||||
if (avatar != null) {
|
||||
getSupportActionBar().setIcon(new BitmapDrawable(getResources(), BitmapUtil.getCroppedBitmap(avatar)));
|
||||
getSupportActionBar().setIcon(new BitmapDrawable(getResources(), BitmapUtil.getCircleCroppedBitmap(avatar)));
|
||||
}
|
||||
} else {
|
||||
title = getString(R.string.ConversationActivity_group_conversation);
|
||||
|
@ -34,7 +34,6 @@ import android.provider.ContactsContract.QuickContact;
|
||||
import org.thoughtcrime.securesms.util.DateUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
@ -55,7 +54,6 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.service.SendReceiveService;
|
||||
import org.thoughtcrime.securesms.util.BitmapUtil;
|
||||
import org.thoughtcrime.securesms.util.Emoji;
|
||||
import org.whispersystems.textsecure.util.Base64;
|
||||
import org.whispersystems.textsecure.util.FutureTaskListener;
|
||||
import org.whispersystems.textsecure.util.ListenableFutureTask;
|
||||
import org.whispersystems.textsecure.util.Util;
|
||||
@ -65,7 +63,6 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
|
||||
import static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext;
|
||||
|
||||
@ -178,17 +175,19 @@ public class ConversationItem extends LinearLayout {
|
||||
/// MessageRecord Attribute Parsers
|
||||
|
||||
private void setBodyText(MessageRecord messageRecord) {
|
||||
// TODO jake is going to fill these in
|
||||
switch (messageRecord.getGroupAction()) {
|
||||
case GroupContext.Type.QUIT_VALUE:
|
||||
bodyText.setText(messageRecord.getIndividualRecipient().toShortString() + " has left the group.");
|
||||
bodyText.setText(context.getString(R.string.ConversationItem_group_action_left,
|
||||
messageRecord.getIndividualRecipient().toShortString()));
|
||||
return;
|
||||
case GroupContext.Type.ADD_VALUE:
|
||||
case GroupContext.Type.CREATE_VALUE:
|
||||
bodyText.setText(Util.join(GroupUtil.getSerializedArgumentMembers(messageRecord.getGroupActionArguments()), ", ") + " have joined the group.");
|
||||
bodyText.setText(context.getString(R.string.ConversationItem_group_action_joined,
|
||||
Util.join(GroupUtil.getSerializedArgumentMembers(messageRecord.getGroupActionArguments()), ", ")));
|
||||
return;
|
||||
case GroupContext.Type.MODIFY_VALUE:
|
||||
bodyText.setText(messageRecord.getIndividualRecipient() + " has updated the group.");
|
||||
bodyText.setText(context.getString(R.string.ConversationItem_group_action_modify,
|
||||
messageRecord.getIndividualRecipient()));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -254,11 +253,9 @@ public class ConversationItem extends LinearLayout {
|
||||
}
|
||||
|
||||
private void setNotificationMmsAttributes(NotificationMmsMessageRecord messageRecord) {
|
||||
String messageSize = String.format(getContext()
|
||||
.getString(R.string.ConversationItem_message_size_d_kb),
|
||||
String messageSize = String.format(context.getString(R.string.ConversationItem_message_size_d_kb),
|
||||
messageRecord.getMessageSize());
|
||||
String expires = String.format(getContext()
|
||||
.getString(R.string.ConversationItem_expires_s),
|
||||
String expires = String.format(context.getString(R.string.ConversationItem_expires_s),
|
||||
DateUtils.getRelativeTimeSpanString(getContext(),
|
||||
messageRecord.getExpiration(),
|
||||
false));
|
||||
@ -341,7 +338,7 @@ public class ConversationItem extends LinearLayout {
|
||||
}
|
||||
|
||||
private void setContactPhotoForRecipient(final Recipient recipient) {
|
||||
contactPhoto.setImageBitmap(BitmapUtil.getCroppedBitmap(recipient.getContactPhoto()));
|
||||
contactPhoto.setImageBitmap(BitmapUtil.getCircleCroppedBitmap(recipient.getContactPhoto()));
|
||||
contactPhoto.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -32,7 +32,6 @@ import android.text.style.StyleSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.QuickContactBadge;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
@ -130,7 +129,7 @@ public class ConversationListItem extends RelativeLayout
|
||||
private void setContactPhoto(final Recipient recipient) {
|
||||
if (recipient == null) return;
|
||||
|
||||
contactPhotoImage.setImageBitmap(BitmapUtil.getCroppedBitmap(recipient.getContactPhoto()));
|
||||
contactPhotoImage.setImageBitmap(BitmapUtil.getCircleCroppedBitmap(recipient.getContactPhoto()));
|
||||
contactPhotoImage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -17,7 +17,9 @@ import android.util.Pair;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@ -36,6 +38,7 @@ import org.thoughtcrime.securesms.recipients.RecipientFormattingException;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.sms.MessageSender;
|
||||
import org.thoughtcrime.securesms.util.ActionBarUtil;
|
||||
import org.thoughtcrime.securesms.util.BitmapUtil;
|
||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
@ -67,20 +70,23 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
|
||||
private final static String TAG = GroupCreateActivity.class.getSimpleName();
|
||||
|
||||
|
||||
public static final String MASTER_SECRET_EXTRA = "master_secret";
|
||||
|
||||
private final DynamicTheme dynamicTheme = new DynamicTheme();
|
||||
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
||||
|
||||
private static final String TEMP_PHOTO_FILE = "__tmp_group_create_avatar_photo.png";
|
||||
private static final String TEMP_PHOTO_FILE = "__tmp_group_create_avatar_photo.tmp";
|
||||
|
||||
private static final int PICK_CONTACT = 1;
|
||||
private static final int PICK_AVATAR = 2;
|
||||
public static final int AVATAR_SIZE = 210;
|
||||
|
||||
private EditText groupName;
|
||||
private ListView lv;
|
||||
private PushRecipientsPanel recipientsPanel;
|
||||
private ImageView avatar;
|
||||
private TextView creatingText;
|
||||
|
||||
private MasterSecret masterSecret;
|
||||
private Bitmap avatarBmp;
|
||||
@ -172,7 +178,13 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
|
||||
private void initializeResources() {
|
||||
masterSecret = getIntent().getParcelableExtra(MASTER_SECRET_EXTRA);
|
||||
groupName = (EditText) findViewById(R.id.group_name);
|
||||
|
||||
lv = (ListView) findViewById(R.id.selected_contacts_list);
|
||||
avatar = (ImageView) findViewById(R.id.avatar);
|
||||
groupName = (EditText) findViewById(R.id.group_name);
|
||||
creatingText = (TextView) findViewById(R.id.creating_group_text);
|
||||
recipientsPanel = (PushRecipientsPanel) findViewById(R.id.recipients);
|
||||
|
||||
groupName.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { }
|
||||
@ -187,7 +199,6 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
}
|
||||
});
|
||||
|
||||
lv = (ListView) findViewById(R.id.selected_contacts_list);
|
||||
SelectedRecipientsAdapter adapter = new SelectedRecipientsAdapter(this, android.R.id.text1, new ArrayList<Recipient>());
|
||||
adapter.setOnRecipientDeletedListener(new SelectedRecipientsAdapter.OnRecipientDeletedListener() {
|
||||
@Override
|
||||
@ -197,7 +208,6 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
});
|
||||
lv.setAdapter(adapter);
|
||||
|
||||
recipientsPanel = (PushRecipientsPanel) findViewById(R.id.recipients);
|
||||
recipientsPanel.setPanelChangeListener(new PushRecipientsPanel.RecipientsPanelChangedListener() {
|
||||
@Override
|
||||
public void onRecipientsPanelUpdate(Recipients recipients) {
|
||||
@ -210,7 +220,6 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
});
|
||||
(findViewById(R.id.contacts_button)).setOnClickListener(new AddRecipientButtonListener());
|
||||
|
||||
avatar = (ImageView) findViewById(R.id.avatar);
|
||||
avatar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@ -219,8 +228,8 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
photoPickerIntent.putExtra("crop", "true");
|
||||
photoPickerIntent.putExtra("aspectX", 1);
|
||||
photoPickerIntent.putExtra("aspectY", 1);
|
||||
photoPickerIntent.putExtra("outputX", 210);
|
||||
photoPickerIntent.putExtra("outputY", 210);
|
||||
photoPickerIntent.putExtra("outputX", AVATAR_SIZE);
|
||||
photoPickerIntent.putExtra("outputY", AVATAR_SIZE);
|
||||
photoPickerIntent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri());
|
||||
photoPickerIntent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString());
|
||||
startActivityForResult(photoPickerIntent, PICK_AVATAR);
|
||||
@ -292,7 +301,8 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
findViewById(R.id.group_details_layout).setVisibility(View.GONE);
|
||||
findViewById(R.id.creating_group_layout).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.menu_create_group).setVisibility(View.GONE);
|
||||
((TextView)findViewById(R.id.creating_group_text)).setText("Creating " + groupName.getText().toString() + "...");
|
||||
if (groupName.getText() != null)
|
||||
creatingText.setText(getString(R.string.GroupCreateActivity_creating_group, groupName.getText().toString()));
|
||||
}
|
||||
|
||||
private void disableWhisperGroupCreatingUi() {
|
||||
@ -312,7 +322,6 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int reqCode, int resultCode, Intent data) {
|
||||
Log.w("ComposeMessageActivity", "onActivityResult called: " + resultCode + " , " + data);
|
||||
super.onActivityResult(reqCode, resultCode, data);
|
||||
|
||||
if (data == null || resultCode != Activity.RESULT_OK)
|
||||
@ -331,7 +340,7 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
addSelectedContact(recipient);
|
||||
}
|
||||
} catch (RecipientFormattingException e) {
|
||||
Log.w("GroupCreateActivity", e);
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -339,10 +348,9 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
break;
|
||||
case PICK_AVATAR:
|
||||
if(resultCode == RESULT_OK) {
|
||||
File tempFile = getTempFile();
|
||||
avatarBmp = BitmapFactory.decodeFile(tempFile.getAbsolutePath());
|
||||
if (avatarBmp != null) avatar.setImageBitmap(avatarBmp);
|
||||
tempFile.delete();
|
||||
|
||||
new DecodeCropAndSetAsyncTask().execute();
|
||||
|
||||
break;
|
||||
} else {
|
||||
Log.i(TAG, "Avatar selection result was not RESULT_OK.");
|
||||
@ -384,7 +392,7 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
} catch (RecipientFormattingException e) {
|
||||
throw new AssertionError(e);
|
||||
} catch (MmsException e) {
|
||||
Log.w("GroupCreateActivity", e);
|
||||
Log.w(TAG, e);
|
||||
groupDatabase.remove(groupId, TextSecurePreferences.getLocalNumber(this));
|
||||
throw new MmsException(e);
|
||||
}
|
||||
@ -409,6 +417,22 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
return results;
|
||||
}
|
||||
|
||||
private class DecodeCropAndSetAsyncTask extends AsyncTask<Void,Void,Bitmap> {
|
||||
|
||||
@Override
|
||||
protected Bitmap doInBackground(Void... voids) {
|
||||
File tempFile = getTempFile();
|
||||
avatarBmp = BitmapUtil.getCircleCroppedBitmap(BitmapFactory.decodeFile(tempFile.getAbsolutePath()));
|
||||
tempFile.delete();
|
||||
return avatarBmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Bitmap result) {
|
||||
if (avatarBmp != null) avatar.setImageBitmap(avatarBmp);
|
||||
}
|
||||
}
|
||||
|
||||
private class CreateMmsGroupAsyncTask extends AsyncTask<Void,Void,Long> {
|
||||
|
||||
@Override
|
||||
@ -460,10 +484,10 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
try {
|
||||
return handleCreatePushGroup(name, avatarBytes, selectedContacts);
|
||||
} catch (MmsException e) {
|
||||
Log.w("GroupCreateActivity", e);
|
||||
Log.w(TAG, e);
|
||||
return new Pair<Long,Recipients>(RES_MMS_EXCEPTION, null);
|
||||
} catch (InvalidNumberException e) {
|
||||
Log.w("GroupCreateActivity", e);
|
||||
Log.w(TAG, e);
|
||||
return new Pair<Long,Recipients>(RES_BAD_NUMBER, null);
|
||||
}
|
||||
}
|
||||
|
@ -339,6 +339,7 @@ public class PushContactSelectionListFragment extends SherlockListFragment
|
||||
public void onLoadFinished(Loader<Cursor> arg0, Cursor cursor) {
|
||||
Cursor pushCursor = ContactAccessor.getInstance().getCursorForContactsWithPush(getActivity());
|
||||
((CursorAdapter) getListAdapter()).changeCursor(new MergeCursor(new Cursor[]{pushCursor,cursor}));
|
||||
((TextView)getView().findViewById(android.R.id.empty)).setText(R.string.contact_selection_group_activity__no_contacts);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -265,6 +265,7 @@ public class SingleContactSelectionListFragment extends SherlockListFragment
|
||||
public void onLoadFinished(Loader<Cursor> arg0, Cursor cursor) {
|
||||
Cursor pushCursor = ContactAccessor.getInstance().getCursorForContactsWithPush(getActivity());
|
||||
((CursorAdapter) getListAdapter()).changeCursor(new MergeCursor(new Cursor[]{pushCursor,cursor}));
|
||||
((TextView)getView().findViewById(android.R.id.empty)).setText(R.string.contact_selection_group_activity__no_contacts);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,7 +12,7 @@ import org.thoughtcrime.securesms.R;
|
||||
|
||||
public class ImageDivet extends ImageView {
|
||||
private static final float CORNER_OFFSET = 12F;
|
||||
private static final String[] POSITIONS = new String[] {"left", "right"};
|
||||
private static final String[] POSITIONS = new String[] {"bottom_right"};
|
||||
|
||||
private Drawable drawable;
|
||||
|
||||
@ -46,16 +46,12 @@ public class ImageDivet extends ImageView {
|
||||
}
|
||||
|
||||
private void setDrawable() {
|
||||
int attributes[] = new int[] {R.attr.conversation_avatar_divet_left,
|
||||
R.attr.conversation_avatar_divet_right};
|
||||
int attributes[] = new int[] {R.attr.lower_right_divet};
|
||||
|
||||
TypedArray drawables = getContext().obtainStyledAttributes(attributes);
|
||||
|
||||
switch (position) {
|
||||
case 0:
|
||||
drawable = drawables.getDrawable(1);
|
||||
break;
|
||||
case 1:
|
||||
drawable = drawables.getDrawable(0);
|
||||
break;
|
||||
}
|
||||
@ -98,26 +94,16 @@ public class ImageDivet extends ImageView {
|
||||
}
|
||||
|
||||
private void computeBounds(Canvas c) {
|
||||
final int left = 0;
|
||||
final int top = 0;
|
||||
final int right = getWidth();
|
||||
|
||||
final int cornerOffset = (int) getCloseOffset();
|
||||
final int bottom = getHeight();
|
||||
|
||||
switch (position) {
|
||||
case 1:
|
||||
drawable.setBounds(
|
||||
right - drawableIntrinsicWidth,
|
||||
top + cornerOffset,
|
||||
right,
|
||||
top + cornerOffset + drawableIntrinsicHeight);
|
||||
break;
|
||||
case 0:
|
||||
drawable.setBounds(
|
||||
left,
|
||||
top + cornerOffset,
|
||||
left + drawableIntrinsicWidth,
|
||||
top + cornerOffset + drawableIntrinsicHeight);
|
||||
right - drawableIntrinsicWidth,
|
||||
bottom - drawableIntrinsicHeight,
|
||||
right,
|
||||
bottom);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import android.graphics.Rect;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@ -66,7 +67,7 @@ public class BitmapUtil {
|
||||
options.inSampleSize = scaler;
|
||||
options.inJustDecodeBounds = false;
|
||||
|
||||
Bitmap roughThumbnail = BitmapFactory.decodeStream(data, null, options);
|
||||
Bitmap roughThumbnail = BitmapFactory.decodeStream(new BufferedInputStream(data), null, options);
|
||||
|
||||
if (roughThumbnail == null) {
|
||||
throw new BitmapDecodingException("Decoded stream was null.");
|
||||
@ -103,7 +104,7 @@ public class BitmapUtil {
|
||||
return options;
|
||||
}
|
||||
|
||||
public static Bitmap getCroppedBitmap(Bitmap bitmap) {
|
||||
public static Bitmap getCircleCroppedBitmap(Bitmap bitmap) {
|
||||
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
|
||||
bitmap.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(output);
|
||||
|