diff options
Diffstat (limited to '')
23 files changed, 700 insertions, 16 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java new file mode 100644 index 00000000..0b5cb897 --- /dev/null +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java @@ -0,0 +1,63 @@ +package de.thedevstack.conversationsplus.ui.adapter; + +import android.content.Context; +import android.graphics.Color; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ImageView; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.Map; + +import de.thedevstack.conversationsplus.R; +import de.thedevstack.conversationsplus.entities.Presences; +import de.thedevstack.conversationsplus.utils.UIHelper; + +/** + * Created by tzur on 27.09.2015. + */ +public class PresencesArrayAdapter extends ArrayAdapter<Presence> { + private final Context context; + private final Presence[] values; + + public PresencesArrayAdapter(Context context, Presences presences) { + super(context, R.layout.dialog_resources_status); + this.context = context; + this.values = getPresenceArray(presences); + addAll(this.values); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + LayoutInflater inflater = (LayoutInflater) context + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View rowView = inflater.inflate(R.layout.dialog_resources_status, parent, false); + TextView textView = (TextView) rowView.findViewById(R.id.dlg_res_stat_resource_name); + textView.setText(this.values[position].resource); + textView.setTextColor(Color.parseColor(UIHelper.getStatusColor(this.values[position].status))); + + return rowView; + } + + private static Presence[] getPresenceArray(Presences presences) { + ArrayList<Presence> presenceArrayList = new ArrayList<>(); + if (null != presences && null != presences.getPresences() && !presences.getPresences().isEmpty()) { + for (Map.Entry<String, Integer> entry : presences.getPresences().entrySet()) { + Presence p = new Presence(); + p.resource = entry.getKey(); + p.status = entry.getValue(); + presenceArrayList.add(p); + } + presenceArrayList.trimToSize(); + } + return presenceArrayList.toArray(new Presence[0]); + } +} + +class Presence { + String resource; + int status; +} diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/AbstractAlertDialog.java b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/AbstractAlertDialog.java new file mode 100644 index 00000000..10764798 --- /dev/null +++ b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/AbstractAlertDialog.java @@ -0,0 +1,125 @@ +package de.thedevstack.conversationsplus.ui.dialogs; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.database.Cursor; +import android.graphics.drawable.Drawable; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ListAdapter; + +import de.thedevstack.conversationsplus.R; + +/** + * Created by tzur on 29.09.2015. + */ +public class AbstractAlertDialog { + protected AlertDialog.Builder builder; + + public AbstractAlertDialog(Context context, String title) { + this.builder = new AlertDialog.Builder(context); + this.builder.setTitle(title); + this.builder.setPositiveButton(R.string.cplus_ok, null); + } + + public AbstractAlertDialog(Context context, int titleTextId) { + this(context, context.getString(titleTextId)); + } + + public void show() { + this.builder.show(); + } + + public Context getContext() { + return builder.getContext(); + } + + public AlertDialog.Builder setTitle(int titleId) { + return builder.setTitle(titleId); + } + + public AlertDialog.Builder setTitle(CharSequence title) { + return builder.setTitle(title); + } + + public AlertDialog.Builder setIcon(int iconId) { + return builder.setIcon(iconId); + } + + public AlertDialog.Builder setIcon(Drawable icon) { + return builder.setIcon(icon); + } + + public AlertDialog.Builder setMessage(CharSequence message) { + return builder.setMessage(message); + } + + public AlertDialog.Builder setMessage(int messageId) { + return builder.setMessage(messageId); + } + + public AlertDialog.Builder setIconAttribute(int attrId) { + return builder.setIconAttribute(attrId); + } + + public AlertDialog.Builder setPositiveButton(int textId, DialogInterface.OnClickListener listener) { + return builder.setPositiveButton(textId, listener); + } + + public AlertDialog.Builder setPositiveButton(CharSequence text, DialogInterface.OnClickListener listener) { + return builder.setPositiveButton(text, listener); + } + + public AlertDialog.Builder setNegativeButton(int textId, DialogInterface.OnClickListener listener) { + return builder.setNegativeButton(textId, listener); + } + + public AlertDialog.Builder setNegativeButton(CharSequence text, DialogInterface.OnClickListener listener) { + return builder.setNegativeButton(text, listener); + } + + public AlertDialog.Builder setNeutralButton(int textId, DialogInterface.OnClickListener listener) { + return builder.setNeutralButton(textId, listener); + } + + public AlertDialog.Builder setNeutralButton(CharSequence text, DialogInterface.OnClickListener listener) { + return builder.setNeutralButton(text, listener); + } + + public AlertDialog.Builder setCancelable(boolean cancelable) { + return builder.setCancelable(cancelable); + } + + public AlertDialog.Builder setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) { + return builder.setOnCancelListener(onCancelListener); + } + + public AlertDialog.Builder setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) { + return builder.setOnDismissListener(onDismissListener); + } + + public AlertDialog.Builder setOnKeyListener(DialogInterface.OnKeyListener onKeyListener) { + return builder.setOnKeyListener(onKeyListener); + } + + public AlertDialog.Builder setAdapter(ListAdapter adapter, DialogInterface.OnClickListener listener) { + return builder.setAdapter(adapter, listener); + } + + public AlertDialog.Builder setCursor(Cursor cursor, DialogInterface.OnClickListener listener, String labelColumn) { + return builder.setCursor(cursor, listener, labelColumn); + } + + public AlertDialog.Builder setView(View view) { + return builder.setView(view); + } + + public AlertDialog.Builder setView(int layoutResId) { + return builder.setView(layoutResId); + } + + public AlertDialog.Builder setOnItemSelectedListener(AdapterView.OnItemSelectedListener listener) { + return builder.setOnItemSelectedListener(listener); + } +} diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java new file mode 100644 index 00000000..25d522f0 --- /dev/null +++ b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java @@ -0,0 +1,183 @@ +package de.thedevstack.conversationsplus.ui.dialogs; + +import android.app.Activity; +import android.text.format.DateFormat; +import android.util.Log; +import android.view.View; +import android.widget.TextView; + +import java.util.Date; + +import de.thedevstack.conversationsplus.R; +import de.thedevstack.conversationsplus.entities.Conversation; +import de.thedevstack.conversationsplus.entities.Message; +import de.thedevstack.conversationsplus.utils.UIHelper; + +/** + * Fills the contents to the message details dialog. + * The view definition is done in R.layout.dialog_message_details. + */ +public class MessageDetailsDialog extends AbstractAlertDialog { + + /** + * Initializes the Message Details Dialog. + * @param context the context of this alert dialog (the parent activity). + * @param message the message to be displayed + */ + public MessageDetailsDialog(Activity context, Message message) { + super(context, R.string.dlg_msg_details_title); + this.createView(context, message); + } + + /** + * Creates the view for the message details alert dialog. + * @param context the context of this alert dialog (the parent activity). + * @param message the message to be displayed + */ + protected void createView(Activity context, Message message) { + int viewId = R.layout.dialog_message_details; + View view = context.getLayoutInflater().inflate(viewId, null); + + displayMessageSentTime(view, message); + displaySenderAndReceiver(view, message); + displayMessageTypeInfo(view, message); + displayMessageStatusInfo(view, message); + displayFileInfo(view, message); + } + + /** + * Publishes file information, if message contains an image to view. + * @param view the dialog view + * @param message the message to display in dialog + */ + protected void displayFileInfo(View view, Message message) { + if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE || message.getTransferable() != null) { + view.findViewById(R.id.dlgMsgDetFileTable).setVisibility(View.VISIBLE); + if (null != message.getFileParams()) { + Message.FileParams params = message.getFileParams(); + TextView tvFilesize = (TextView) view.findViewById(R.id.dlgMsgDetFileSize); + tvFilesize.setText(UIHelper.getHumanReadableFileSize(params.size)); + } + TextView mimetype = (TextView) view.findViewById(R.id.dlgMsgDetFileMimeType); + mimetype.setText(message.getMimeType()); + } + this.setView(view); + } + + /** + * Displays message status info to view. + * @param view the dialog view + * @param message the message to display in dialog + */ + protected void displayMessageStatusInfo(View view, Message message) { + TextView msgStatusTextView = (TextView) view.findViewById(R.id.dlgMsgDetMsgStatus); + int msgStatusResId; + int msgStatusColorResId; + switch (message.getStatus()) { + case Message.STATUS_WAITING: + msgStatusResId = R.string.dlg_msg_details_msg_status_waiting; + msgStatusColorResId = R.color.black87; + break; + case Message.STATUS_UNSEND: + msgStatusResId = R.string.dlg_msg_details_msg_status_unsend; + msgStatusColorResId = R.color.black87; + break; + case Message.STATUS_OFFERED: + msgStatusResId = R.string.dlg_msg_details_msg_status_offered; + msgStatusColorResId = R.color.black87; + break; + case Message.STATUS_SEND_FAILED: + msgStatusResId = R.string.dlg_msg_details_msg_status_failed; + msgStatusColorResId = R.color.red500; + break; + case Message.STATUS_RECEIVED: + msgStatusResId = R.string.dlg_msg_details_msg_status_received; + msgStatusColorResId = R.color.black87; + break; + case Message.STATUS_SEND: + case Message.STATUS_SEND_DISPLAYED: + case Message.STATUS_SEND_RECEIVED: + default: + msgStatusResId = R.string.dlg_msg_details_msg_status_sent; + msgStatusColorResId = R.color.black87; + } + msgStatusTextView.setText(msgStatusResId); + msgStatusTextView.setTextColor(getContext().getResources().getColor(msgStatusColorResId)); + } + + /** + * Publishes message type information to view. + * @param view the dialog view + * @param message the message to display in dialog + */ + protected void displayMessageTypeInfo(View view, Message message) { + TextView msgTypeTextView = (TextView) view.findViewById(R.id.dlgMsgDetMsgType); + int msgTypeResId; + switch (message.getType()) { + case Message.TYPE_PRIVATE: + msgTypeResId = R.string.dlg_msg_details_msg_type_private; + break; + case Message.TYPE_FILE: + msgTypeResId = R.string.dlg_msg_details_msg_type_file; + break; + case Message.TYPE_IMAGE: + msgTypeResId = R.string.dlg_msg_details_msg_type_image; + break; + case Message.TYPE_STATUS: + msgTypeResId = R.string.dlg_msg_details_msg_type_status; + break; + case Message.TYPE_TEXT: + default: + msgTypeResId = R.string.dlg_msg_details_msg_type_text; + } + msgTypeTextView.setText(msgTypeResId); + } + + /** + * Publishes information about sending and receiving parties to view. + * @param view the dialog view + * @param message the message to display in dialog + */ + protected void displaySenderAndReceiver(View view, Message message) { + Conversation conversation = message.getConversation(); + // Get own resource name -> What about msg written on other client? + String me = conversation.getAccount().getJid().getResourcepart(); + // Get resource name of chat partner, if available + String other = (message.getCounterpart().isBareJid()) ? "" : message.getCounterpart().getResourcepart(); + Log.d("MesageDialog", "Me: " + me + ", other: " + other); + TextView sender = (TextView) view.findViewById(R.id.dlgMsgDetSender); + TextView receipient = (TextView) view.findViewById(R.id.dlgMsgDetReceipient); + + if (conversation.getMode() == Conversation.MODE_MULTI) { + // Change label of sending and receiving party to MUC terminology + TextView senderLabel = (TextView) view.findViewById(R.id.dlgMsgDetLblSender); + senderLabel.setText(R.string.dlg_msg_details_sender_nick); + TextView receipientLabel = (TextView) view.findViewById(R.id.dlgMsgDetLblReceipient); + receipientLabel.setText(R.string.dlg_msg_details_receipient_nick); + + // Get own nick for MUC + me = conversation.getMucOptions().getActualNick(); + } + if (Message.STATUS_RECEIVED == message.getStatus()) { + // Sender was chat partner, if the status is for my account received + sender.setText(other); + // Set receipient to myself in case of normal chat or private message in MUC + if (conversation.getMode() == Conversation.MODE_SINGLE || Message.TYPE_PRIVATE == message.getType()) { + receipient.setText(me); + } + } else { + sender.setText(me); + receipient.setText(other); + } + } + + /** + * Publishes information about message sent time to view. + * @param view the dialog view + * @param message the message to display in dialog + */ + protected void displayMessageSentTime(View view, Message message) { + TextView timeSent = (TextView) view.findViewById(R.id.dlgMsgDetTimeSent); + timeSent.setText(DateFormat.format("dd.MM.yyyy kk:mm:ss", new Date(message.getMergedTimeSent()))); + } +} diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ShowResourcesListDialogListener.java b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ShowResourcesListDialogListener.java new file mode 100644 index 00000000..070ea58c --- /dev/null +++ b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/ShowResourcesListDialogListener.java @@ -0,0 +1,47 @@ +package de.thedevstack.conversationsplus.ui.listeners; + +import android.content.Context; +import android.view.View; + +import de.thedevstack.conversationsplus.R; +import de.thedevstack.conversationsplus.entities.Contact; +import de.thedevstack.conversationsplus.ui.adapter.PresencesArrayAdapter; +import de.thedevstack.conversationsplus.ui.dialogs.AbstractAlertDialog; + +/** + * This listener shows the dialog with the resources of a contact. + * The resources are shown with the color of their current online mode. + * This listener implements OnClickListener and OnLongClickListener. + */ +public class ShowResourcesListDialogListener extends AbstractAlertDialog implements View.OnClickListener, View.OnLongClickListener { + private Contact contact; + + public ShowResourcesListDialogListener(Context context, Contact contact) { + super(context, getTitle(context, contact)); + this.contact = contact; + this.init(); + } + + private static final String getTitle(Context context, Contact contact) { + if (null != contact && null != contact.getJid() && null != contact.getJid().toBareJid()) { + int presenceCount = null != contact.getPresences() ? contact.getPresences().size() : 0; + return context.getString(R.string.dlg_resources_title, contact.getJid().toBareJid().toString(), presenceCount); + } + return null != contact ? contact.toString() : ""; + } + + protected void init() { + this.builder.setAdapter(new PresencesArrayAdapter(getContext(), this.contact.getPresences()), null); + } + + @Override + public void onClick(View v) { + this.show(); + } + + @Override + public boolean onLongClick(View view) { + this.show(); + return true; + } +} diff --git a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java index 16984910..3607b69a 100644 --- a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java @@ -35,7 +35,8 @@ public abstract class AbstractGenerator { "urn:xmpp:receipts" }; private String mVersion = null; - public final String IDENTITY_NAME = "Conversations"; + //FIXME use appname or similar!!!!!!!!!!!11elf + public final String IDENTITY_NAME = "Conversations+"; public final String IDENTITY_TYPE = "phone"; private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index c190caed..40d5bc92 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -32,6 +32,7 @@ import org.openintents.openpgp.util.OpenPgpUtils; import java.util.List; +import de.thedevstack.conversationsplus.ui.listeners.ShowResourcesListDialogListener; import eu.siacs.conversations.R; import eu.siacs.conversations.crypto.PgpEngine; import eu.siacs.conversations.entities.Account; @@ -350,6 +351,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd } else { contactJidTv.setText(contact.getJid().toString()); } + contactJidTv.setOnClickListener(new ShowResourcesListDialogListener(ContactDetailsActivity.this, contact)); accountJidTv.setText(getString(R.string.using_account, contact.getAccount().getJid().toBareJid())); badge.setImageBitmap(avatarService().get(contact, getPixel(72))); badge.setOnClickListener(this.onBadgeClick); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index bf261dba..475b0e9e 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -259,9 +259,10 @@ public class ConversationActivity extends XmppActivity } if (mContentView instanceof SlidingPaneLayout) { SlidingPaneLayout mSlidingPaneLayout = (SlidingPaneLayout) mContentView; + // Move the conversation list when sliding the selected conversation mSlidingPaneLayout.setParallaxDistance(150); - mSlidingPaneLayout - .setShadowResource(R.drawable.es_slidingpane_shadow); + // The shadow between conversation list and selected conversation + mSlidingPaneLayout.setShadowResourceLeft(R.drawable.es_slidingpane_shadow); mSlidingPaneLayout.setSliderFadeColor(0); mSlidingPaneLayout.setPanelSlideListener(new PanelSlideListener() { diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index eb2688fd..70462d03 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -42,6 +42,8 @@ import java.util.List; import java.util.NoSuchElementException; import java.util.concurrent.ConcurrentLinkedQueue; +import de.thedevstack.conversationsplus.ui.dialogs.MessageDetailsDialog; +import de.thedevstack.conversationsplus.ui.listeners.ConversationSwipeRefreshListener; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.crypto.PgpEngine; @@ -500,6 +502,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa @Override public boolean onContextItemSelected(MenuItem item) { switch (item.getItemId()) { + case R.id.msg_ctx_mnu_details: + new MessageDetailsDialog(getActivity(), selectedMessage).show(); + return true; case R.id.share_with: shareWith(selectedMessage); return true; diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index 7443c0cb..9d8cc0ba 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -7,6 +7,7 @@ import android.graphics.Typeface; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.AsyncTask; +import android.util.Log; import android.util.Pair; import android.view.LayoutInflater; import android.view.View; @@ -19,6 +20,7 @@ import java.lang.ref.WeakReference; import java.util.List; import java.util.concurrent.RejectedExecutionException; +import de.thedevstack.conversationsplus.ui.listeners.ShowResourcesListDialogListener; import de.tzur.conversations.Settings; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; @@ -61,11 +63,12 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { view = inflater.inflate(R.layout.conversation_list_row,parent, false); } Conversation conversation = getItem(position); + // Highlight the currently selected conversation if (this.activity instanceof ConversationActivity) { - View swipeableItem = view.findViewById(R.id.swipeable_item); ConversationActivity a = (ConversationActivity) this.activity; - int c = !a.isConversationsOverviewHideable() && conversation == a.getSelectedConversation() ? a.getSecondaryBackgroundColor() : a.getPrimaryBackgroundColor(); - swipeableItem.setBackgroundColor(c); + int c = conversation == a.getSelectedConversation() ? a.getSecondaryBackgroundColor() : a.getPrimaryBackgroundColor(); + view.findViewById(R.id.conversationListRowContent).setBackgroundColor(c); + view.findViewById(R.id.conversationListRowFrame).setBackgroundColor(c); } TextView convName = (TextView) view.findViewById(R.id.conversation_name); if (conversation.getMode() == Conversation.MODE_SINGLE || activity.useSubjectToIdentifyConference()) { @@ -77,7 +80,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { TextView mTimestamp = (TextView) view.findViewById(R.id.conversation_lastupdate); ImageView imagePreview = (ImageView) view.findViewById(R.id.conversation_lastimage); - if (Settings.SHOW_ONLINE_STATUS && conversation != null && conversation.getAccount().getStatus() == Account.State.ONLINE) { + if (Settings.SHOW_ONLINE_STATUS && conversation.getAccount().getStatus() == Account.State.ONLINE) { TextView status = (TextView) view.findViewById(R.id.status); String color = "#000000"; @@ -138,7 +141,8 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { mTimestamp.setText(UIHelper.readableTimeDifference(activity,conversation.getLatestMessage().getTimeSent())); ImageView profilePicture = (ImageView) view.findViewById(R.id.conversation_image); - loadAvatar(conversation,profilePicture); + profilePicture.setOnLongClickListener(new ShowResourcesListDialogListener(activity, conversation.getContact())); + loadAvatar(conversation, profilePicture); return view; } @@ -225,4 +229,4 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { return bitmapWorkerTaskReference.get(); } } -}
\ No newline at end of file +} diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java index 76f48037..7562c446 100644 --- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java @@ -1,5 +1,7 @@ package eu.siacs.conversations.utils; +import java.math.BigDecimal; +import java.text.NumberFormat; import java.util.ArrayList; import java.util.Arrays; import java.net.URLConnection; @@ -287,4 +289,20 @@ public class UIHelper { body = body.replace("?","").replace("¿",""); return LOCATION_QUESTIONS.contains(body); } + + public static String getHumanReadableFileSize(long filesize) { + if (0 > filesize) { + return "?"; + } + double size = Double.valueOf(filesize); + String[] sizes = {" bytes", " Kb", " Mb", " Gb", " Tb"}; + int i = 0; + while (1023 < size) { + size /= 1024d; + ++i; + } + BigDecimal readableSize = new BigDecimal(size); + readableSize = readableSize.setScale(2, BigDecimal.ROUND_HALF_UP); + return readableSize.doubleValue() + sizes[i]; + } } diff --git a/src/main/res/drawable-hdpi/ic_launcher.png b/src/main/res/drawable-hdpi/ic_launcher.png Binary files differindex 25fc8591..1bea2f74 100644 --- a/src/main/res/drawable-hdpi/ic_launcher.png +++ b/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/src/main/res/drawable-mdpi/ic_launcher.png b/src/main/res/drawable-mdpi/ic_launcher.png Binary files differindex 733e9615..f2df046e 100644 --- a/src/main/res/drawable-mdpi/ic_launcher.png +++ b/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/src/main/res/drawable-xhdpi/ic_launcher.png b/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differindex c9e48859..2c0f1647 100644 --- a/src/main/res/drawable-xhdpi/ic_launcher.png +++ b/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/src/main/res/drawable-xxhdpi/ic_launcher.png b/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differindex e69b9c8d..f8edda90 100644 --- a/src/main/res/drawable-xxhdpi/ic_launcher.png +++ b/src/main/res/drawable-xxhdpi/ic_launcher.png diff --git a/src/main/res/drawable-xxxhdpi/ic_launcher.png b/src/main/res/drawable-xxxhdpi/ic_launcher.png Binary files differindex 668504df..d9aa6c0e 100644 --- a/src/main/res/drawable-xxxhdpi/ic_launcher.png +++ b/src/main/res/drawable-xxxhdpi/ic_launcher.png diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/conversation_list_row.xml index c79628d4..efa10748 100644 --- a/src/main/res/layout/conversation_list_row.xml +++ b/src/main/res/layout/conversation_list_row.xml @@ -5,7 +5,8 @@ android:layout_height="wrap_content" android:orientation="horizontal" android:padding="8dp" - android:descendantFocusability="blocksDescendants"> + android:descendantFocusability="blocksDescendants" + android:id="@+id/conversationListRowFrame"> <View android:layout_width="fill_parent" @@ -21,9 +22,9 @@ <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" - android:background="?android:selectableItemBackground" android:orientation="horizontal" - android:padding="8dp" > + android:padding="8dp" + android:id="@+id/conversationListRowContent"> <ImageView android:id="@+id/conversation_image" @@ -46,7 +47,7 @@ android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toRightOf="@+id/conversation_image" - android:paddingLeft="8dp" > + android:paddingLeft="8dp"> <TextView diff --git a/src/main/res/layout/dialog_message_details.xml b/src/main/res/layout/dialog_message_details.xml new file mode 100644 index 00000000..4d63831e --- /dev/null +++ b/src/main/res/layout/dialog_message_details.xml @@ -0,0 +1,168 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="8dp"> + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/dlg_msg_details_time_sent" + android:id="@+id/dlgMsgDetLblTimeSent" /> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/dlgMsgDetTimeSent" + android:width="200dp" + android:layout_alignParentTop="true" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" + android:textAlignment="viewEnd" + android:gravity="end" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/dlg_msg_details_msg_type" + android:id="@+id/dlgMsgDetLblMsgType" + android:layout_below="@+id/dlgMsgDetLblTimeSent" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/dlgMsgDetMsgType" + android:layout_below="@+id/dlgMsgDetTimeSent" + android:layout_alignRight="@+id/dlgMsgDetTimeSent" + android:layout_alignEnd="@+id/dlgMsgDetTimeSent" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/dlg_msg_details_msg_status" + android:id="@+id/dlgMsgDetLblMsgStatus" + android:layout_below="@+id/dlgMsgDetLblMsgType" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/dlgMsgDetMsgStatus" + android:layout_below="@+id/dlgMsgDetMsgType" + android:layout_alignRight="@+id/dlgMsgDetMsgType" + android:layout_alignEnd="@+id/dlgMsgDetMsgType" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/dlg_msg_details_sender_resource" + android:id="@+id/dlgMsgDetLblSender" + android:layout_below="@+id/dlgMsgDetLblMsgStatus" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/dlgMsgDetSender" + android:layout_below="@+id/dlgMsgDetMsgStatus" + android:layout_alignRight="@+id/dlgMsgDetMsgStatus" + android:layout_alignEnd="@+id/dlgMsgDetMsgStatus" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/dlg_msg_details_receipient_resource" + android:id="@+id/dlgMsgDetLblReceipient" + android:layout_below="@+id/dlgMsgDetLblSender" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/dlgMsgDetReceipient" + android:layout_below="@+id/dlgMsgDetSender" + android:layout_alignRight="@+id/dlgMsgDetSender" + android:layout_alignEnd="@+id/dlgMsgDetSender" /> + + <TableLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/dlgMsgDetLblReceipient" + android:layout_marginTop="11dp" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" + android:stretchColumns="1" + android:background="@color/black87" + android:id="@+id/dlgMsgDetFileTable" + android:visibility="gone"> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@color/white" + android:layout_marginTop="0.3dp" + android:layout_marginLeft="0.3dp" + android:layout_marginRight="0.3dp"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/dlg_msg_details_file_details" + android:layout_column="0"/> + </TableRow> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@color/white" + android:layout_marginTop="0.3dp" + android:layout_marginLeft="0.3dp" + android:layout_marginRight="0.3dp"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/dlg_msg_details_file_mime" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="" + android:textAlignment="textEnd" + android:gravity="end" + android:id="@+id/dlgMsgDetFileMimeType" /> + </TableRow> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@color/white" + android:layout_marginLeft="0.3dp" + android:layout_marginTop="0.3dp" + android:layout_marginRight="0.3dp"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/dlg_msg_details_file_size" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="" + android:textAlignment="textEnd" + android:gravity="end" + android:id="@+id/dlgMsgDetFileSize"/> + </TableRow> + </TableLayout> + </RelativeLayout> + + + +</LinearLayout>
\ No newline at end of file diff --git a/src/main/res/layout/dialog_resources_status.xml b/src/main/res/layout/dialog_resources_status.xml new file mode 100644 index 00000000..4dd511f5 --- /dev/null +++ b/src/main/res/layout/dialog_resources_status.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceMedium" + android:text="Medium Text" + android:id="@+id/dlg_res_stat_resource_name" + android:layout_marginLeft="10dp" /> +</LinearLayout>
\ No newline at end of file diff --git a/src/main/res/layout/message_received.xml b/src/main/res/layout/message_received.xml index 68ed5711..82f85176 100644 --- a/src/main/res/layout/message_received.xml +++ b/src/main/res/layout/message_received.xml @@ -44,7 +44,7 @@ android:id="@+id/message_body" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:autoLink="web" + android:autoLink="web|phone|email" android:textColor="@color/black87" android:textSize="?attr/TextSizeBody" emojicon:emojiconSize="28sp" /> diff --git a/src/main/res/layout/message_sent.xml b/src/main/res/layout/message_sent.xml index 563e2e29..3b8212a5 100644 --- a/src/main/res/layout/message_sent.xml +++ b/src/main/res/layout/message_sent.xml @@ -44,7 +44,7 @@ android:id="@+id/message_body" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:autoLink="web" + android:autoLink="web|phone|email" android:textColor="@color/black87" android:textSize="?attr/TextSizeBody" emojicon:emojiconSize="28sp" /> diff --git a/src/main/res/menu/message_context.xml b/src/main/res/menu/message_context.xml index 4e1316d3..2fe1ca22 100644 --- a/src/main/res/menu/message_context.xml +++ b/src/main/res/menu/message_context.xml @@ -1,6 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > - + <item + android:id="@+id/msg_ctx_mnu_details" + android:title="@string/msg_ctx_mnu_details" + android:visible="true"/> <item android:id="@+id/copy_text" android:title="@string/copy_text" diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 2d5337be..16ed5239 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -466,4 +466,29 @@ <string name="search_for_contacts_or_groups">Nach Kontakten oder Konferenzen suchen</string> <string name="pref_led_notification_color">LED-Benachrichtigung Farbe</string> <string name="pref_led_notification_color_summary">Setze die Farbe der LED-Benachrichtigung</string> + <string name="msg_ctx_mnu_details">Nachrichtendetails</string> + <string name="dlg_msg_details_title">Nachrichtendetails</string> + <string name="cplus_ok">Ok</string> + <string name="dlg_resources_title">%1$s (%2$d)</string><!-- %s = bare jid, %d = count of online resources --> + <string name="dlg_msg_details_receipient_resource">Empfänger Resource:</string> + <string name="dlg_msg_details_receipient_nick">Empfänger Nickname:</string> + <string name="dlg_msg_details_sender_resource">Absender Resource:</string> + <string name="dlg_msg_details_sender_nick">Absender Nickname:</string> + <string name="dlg_msg_details_time_sent">Gesendet:</string> + <string name="dlg_msg_details_msg_type">Nachrichtentyp:</string> + <string name="dlg_msg_details_msg_status">Nachrichtenstatus:</string> + <string name="dlg_msg_details_file_details">Dateidetails</string> + <string name="dlg_msg_details_file_mime">Mime Type</string> + <string name="dlg_msg_details_file_size">Größe</string> + <string name="dlg_msg_details_msg_type_text">Text</string> + <string name="dlg_msg_details_msg_type_image">Bild</string> + <string name="dlg_msg_details_msg_type_file">Datei</string> + <string name="dlg_msg_details_msg_type_status">Status</string> + <string name="dlg_msg_details_msg_type_private">Privat</string> + <string name="dlg_msg_details_msg_status_sent">Gesendet</string> + <string name="dlg_msg_details_msg_status_received">Empfangen</string> + <string name="dlg_msg_details_msg_status_waiting">Wartend</string> + <string name="dlg_msg_details_msg_status_unsend">In Übertragung</string> + <string name="dlg_msg_details_msg_status_offered">Angeboten</string> + <string name="dlg_msg_details_msg_status_failed">Fehlgeschlagen</string> </resources> diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 94d75164..25eb3dbd 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -495,4 +495,29 @@ <string name="search_for_contacts_or_groups">Search for contacts or groups</string> <string name="pref_led_notification_color">LED notification color</string> <string name="pref_led_notification_color_summary">Change the color of the LED notification</string> + <string name="msg_ctx_mnu_details">Message Details</string> + <string name="dlg_msg_details_title">Message Details</string> + <string name="cplus_ok">Ok</string> + <string name="dlg_resources_title">%1$s (%2$d)</string><!-- %s = bare jid, %d = count of online resources --> + <string name="dlg_msg_details_receipient_resource">Receipient Resource:</string> + <string name="dlg_msg_details_receipient_nick">Receipient Nick:</string> + <string name="dlg_msg_details_sender_resource">Sender Resource:</string> + <string name="dlg_msg_details_sender_nick">Sender Nick:</string> + <string name="dlg_msg_details_time_sent">Time Sent:</string> + <string name="dlg_msg_details_msg_type">Message Type:</string> + <string name="dlg_msg_details_msg_status">Message Status:</string> + <string name="dlg_msg_details_file_details">File Details</string> + <string name="dlg_msg_details_file_mime">Mime Type</string> + <string name="dlg_msg_details_file_size">Size</string> + <string name="dlg_msg_details_msg_type_text">Text</string> + <string name="dlg_msg_details_msg_type_image">Image</string> + <string name="dlg_msg_details_msg_type_file">File</string> + <string name="dlg_msg_details_msg_type_status">Status</string> + <string name="dlg_msg_details_msg_type_private">Private</string> + <string name="dlg_msg_details_msg_status_sent">Sent</string> + <string name="dlg_msg_details_msg_status_received">Received</string> + <string name="dlg_msg_details_msg_status_waiting">Waiting</string> + <string name="dlg_msg_details_msg_status_unsend">Unsend</string> + <string name="dlg_msg_details_msg_status_offered">Offered</string> + <string name="dlg_msg_details_msg_status_failed">Failed</string> </resources> |