diff options
Diffstat (limited to 'src')
34 files changed, 284 insertions, 127 deletions
diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 430980a20..4adf56287 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -21,6 +21,8 @@ public final class Config { public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification + public static final boolean ALWAYS_NOTIFY_BY_DEFAULT = false; + public static final boolean LEGACY_NAMESPACE_HTTP_UPLOAD = false; // true = 'eu:siacs:conversations:http:upload' false = 'urn:xmpp:http:upload' public static final int PING_MAX_INTERVAL = 300; @@ -39,6 +41,7 @@ public final class Config { public static final int IMAGE_SIZE = 1920; public static final Bitmap.CompressFormat IMAGE_FORMAT = Bitmap.CompressFormat.JPEG; public static final int IMAGE_QUALITY = 75; + public static final int IMAGE_MAX_SIZE = 524288; //512KiB public static final int MESSAGE_MERGE_WINDOW = 20; diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index 7685d896b..9ca682752 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -48,6 +48,7 @@ public class Conversation extends AbstractEntity implements Blockable { public static final String ATTRIBUTE_NEXT_ENCRYPTION = "next_encryption"; public static final String ATTRIBUTE_MUC_PASSWORD = "muc_password"; public static final String ATTRIBUTE_MUTED_TILL = "muted_till"; + public static final String ATTRIBUTE_ALWAYS_NOTIFY = "always_notify"; private String name; private String contactUuid; @@ -560,7 +561,7 @@ public class Conversation extends AbstractEntity implements Blockable { /** * short for is Private and Non-anonymous */ - public boolean isPnNA() { + private boolean isPnNA() { return mode == MODE_SINGLE || (getMucOptions().membersOnly() && getMucOptions().nonanonymous()); } @@ -743,6 +744,10 @@ public class Conversation extends AbstractEntity implements Blockable { return System.currentTimeMillis() < this.getLongAttribute(ATTRIBUTE_MUTED_TILL, 0); } + public boolean alwaysNotify() { + return mode == MODE_SINGLE || getBooleanAttribute(ATTRIBUTE_ALWAYS_NOTIFY,Config.ALWAYS_NOTIFY_BY_DEFAULT || isPnNA()); + } + public boolean setAttribute(String key, String value) { try { this.attributes.put(key, value); @@ -786,6 +791,15 @@ public class Conversation extends AbstractEntity implements Blockable { } } + public boolean getBooleanAttribute(String key, boolean defaultValue) { + String value = this.getAttribute(key); + if (value == null) { + return defaultValue; + } else { + return Boolean.parseBoolean(value); + } + } + public void add(Message message) { message.setConversation(this); synchronized (this.messages) { diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index 4a49d1b3c..c5831e7ec 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -363,7 +363,7 @@ public class Message extends AbstractEntity { && this.counterpart.equals(message.getCounterpart()) && (body.equals(otherBody) ||(message.getEncryption() == Message.ENCRYPTION_PGP - && message.getRemoteMsgId().matches("[0-9a-f]{8}-[0-9a-f]{4}-4[0-9]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"))) ; + && message.getRemoteMsgId().matches("[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"))) ; } else { return this.remoteMsgId == null && this.counterpart.equals(message.getCounterpart()) diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index 5366fdee7..05932acce 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -135,7 +135,7 @@ public class FileBackend { } File file = new File(path); long size = file.length(); - if (size == 0 || size >= 524288 ) { + if (size == 0 || size >= Config.IMAGE_MAX_SIZE ) { return false; } BitmapFactory.Options options = new BitmapFactory.Options(); @@ -211,8 +211,6 @@ public class FileBackend { try { file.createNewFile(); is = mXmppConnectionService.getContentResolver().openInputStream(image); - os = new FileOutputStream(file); - Bitmap originalBitmap; BitmapFactory.Options options = new BitmapFactory.Options(); int inSampleSize = (int) Math.pow(2, sampleSize); @@ -226,12 +224,20 @@ public class FileBackend { Bitmap scaledBitmap = resize(originalBitmap, Config.IMAGE_SIZE); int rotation = getRotation(image); scaledBitmap = rotate(scaledBitmap, rotation); - boolean success = scaledBitmap.compress(Config.IMAGE_FORMAT, Config.IMAGE_QUALITY, os); - if (!success) { - throw new FileCopyException(R.string.error_compressing_image); + boolean targetSizeReached = false; + long size = 0; + int quality = Config.IMAGE_QUALITY; + while(!targetSizeReached) { + os = new FileOutputStream(file); + boolean success = scaledBitmap.compress(Config.IMAGE_FORMAT, quality, os); + if (!success) { + throw new FileCopyException(R.string.error_compressing_image); + } + os.flush(); + size = file.getSize(); + targetSizeReached = size <= Config.IMAGE_MAX_SIZE || quality <= 50; + quality -= 5; } - os.flush(); - long size = file.getSize(); int width = scaledBitmap.getWidth(); int height = scaledBitmap.getHeight(); message.setBody(Long.toString(size) + '|' + width + '|' + height); diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index b43b9f93c..b01ad4441 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -62,9 +62,7 @@ public class NotificationService { return (message.getStatus() == Message.STATUS_RECEIVED) && notificationsEnabled() && !message.getConversation().isMuted() - && (message.getConversation().isPnNA() - || conferenceNotificationsEnabled() - || wasHighlightedOrPrivate(message) + && (message.getConversation().alwaysNotify() || wasHighlightedOrPrivate(message) ); } @@ -109,10 +107,6 @@ public class NotificationService { } } - public boolean conferenceNotificationsEnabled() { - return mXmppConnectionService.getPreferences().getBoolean("always_notify_in_conference", false); - } - public void pushFromBacklog(final Message message) { if (notify(message)) { synchronized (notifications) { diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 5c7cceb35..e707fc985 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -414,8 +414,10 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } public void attachImageToConversation(final Conversation conversation, final Uri uri, final UiCallback<Message> callback) { - if (getFileBackend().useImageAsIs(uri)) { - Log.d(Config.LOGTAG, "using image as is"); + final String compressPictures = getCompressPicturesPreference(); + if ("never".equals(compressPictures) + || ("auto".equals(compressPictures) && getFileBackend().useImageAsIs(uri))) { + Log.d(Config.LOGTAG,conversation.getAccount().getJid().toBareJid()+ ": not compressing picture. sending as file"); attachFileToConversation(conversation, uri, callback); return; } @@ -590,6 +592,10 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa return getPreferences().getBoolean("away_when_screen_off", false); } + private String getCompressPicturesPreference() { + return getPreferences().getString("picture_compression", "auto"); + } + private int getTargetPresence() { if (xaOnSilentMode() && isPhoneSilenced()) { return Presences.XA; diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index b3de28b38..6653dd24c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -28,6 +28,7 @@ import org.openintents.openpgp.util.OpenPgpUtils; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.concurrent.atomic.AtomicInteger; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; @@ -64,7 +65,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers private TextView mConferenceType; private TableLayout mConferenceInfoTable; private TextView mConferenceInfoMam; + private TextView mNotifyStatusText; private ImageButton mChangeConferenceSettingsButton; + private ImageButton mNotifyStatusButton; private Button mInviteButton; private String uuid = null; private User mSelectedUser = null; @@ -99,6 +102,47 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } }; + + private OnClickListener mNotifyStatusClickListener = new OnClickListener() { + @Override + public void onClick(View v) { + AlertDialog.Builder builder = new AlertDialog.Builder(ConferenceDetailsActivity.this); + builder.setTitle(R.string.pref_notification_settings); + String[] choices = { + getString(R.string.notify_on_all_messages), + getString(R.string.notify_only_when_highlighted), + getString(R.string.notify_never) + }; + final AtomicInteger choice; + if (mConversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL,0) == Long.MAX_VALUE) { + choice = new AtomicInteger(2); + } else { + choice = new AtomicInteger(mConversation.alwaysNotify() ? 0 : 1); + } + builder.setSingleChoiceItems(choices, choice.get(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + choice.set(which); + } + }); + builder.setNegativeButton(R.string.cancel, null); + builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + if (choice.get() == 2) { + mConversation.setMutedTill(Long.MAX_VALUE); + } else { + mConversation.setMutedTill(0); + mConversation.setAttribute(Conversation.ATTRIBUTE_ALWAYS_NOTIFY,String.valueOf(choice.get() == 0)); + } + xmppConnectionService.updateConversation(mConversation); + updateView(); + } + }); + builder.create().show(); + } + }; + private OnClickListener mChangeConferenceSettings = new OnClickListener() { @Override public void onClick(View v) { @@ -222,6 +266,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers this.mConferenceInfoTable = (TableLayout) findViewById(R.id.muc_info_more); mConferenceInfoTable.setVisibility(this.mAdvancedMode ? View.VISIBLE : View.GONE); this.mConferenceInfoMam = (TextView) findViewById(R.id.muc_info_mam); + this.mNotifyStatusButton = (ImageButton) findViewById(R.id.notification_status_button); + this.mNotifyStatusButton.setOnClickListener(this.mNotifyStatusClickListener); + this.mNotifyStatusText = (TextView) findViewById(R.id.notification_status_text); } @Override @@ -493,6 +540,22 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers mChangeConferenceSettingsButton.setVisibility(View.GONE); } } + + long mutedTill = mConversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL,0); + if (mutedTill == Long.MAX_VALUE) { + mNotifyStatusText.setText(R.string.notify_never); + mNotifyStatusButton.setImageResource(R.drawable.ic_notifications_off_grey600_24dp); + } else if (System.currentTimeMillis() < mutedTill) { + mNotifyStatusText.setText(R.string.notify_paused); + mNotifyStatusButton.setImageResource(R.drawable.ic_notifications_paused_grey600_24dp); + } else if (mConversation.alwaysNotify()) { + mNotifyStatusButton.setImageResource(R.drawable.ic_notifications_grey600_24dp); + mNotifyStatusText.setText(R.string.notify_on_all_messages); + } else { + mNotifyStatusButton.setImageResource(R.drawable.ic_notifications_none_grey600_24dp); + mNotifyStatusText.setText(R.string.notify_only_when_highlighted); + } + LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); membersView.removeAllViews(); final ArrayList<User> users = mucOptions.getUsers(); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 6391241ec..365083f84 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -742,14 +742,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } }; - private OnClickListener mUnmuteClickListener = new OnClickListener() { - - @Override - public void onClick(final View v) { - activity.unmuteConversation(conversation); - } - }; - private OnClickListener mAnswerSmpClickListener = new OnClickListener() { @Override public void onClick(View view) { @@ -805,8 +797,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa && (conversation.getOtrSession().getSessionStatus() == SessionStatus.ENCRYPTED) && (!conversation.isOtrFingerprintVerified())) { showSnackbar(R.string.unknown_otr_fingerprint, R.string.verify, clickToVerify); - } else if (conversation.isMuted()) { - showSnackbar(R.string.notifications_disabled, R.string.enable, this.mUnmuteClickListener); } else { hideSnackbar(); } 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 a4a80dc4b..f5f48a262 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -59,6 +59,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { TextView mLastMessage = (TextView) view.findViewById(R.id.conversation_lastmsg); TextView mTimestamp = (TextView) view.findViewById(R.id.conversation_lastupdate); ImageView imagePreview = (ImageView) view.findViewById(R.id.conversation_lastimage); + ImageView notificationStatus = (ImageView) view.findViewById(R.id.notification_status); Message message = conversation.getLatestMessage(); @@ -94,6 +95,20 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { } } + long muted_till = conversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL,0); + if (muted_till == Long.MAX_VALUE) { + notificationStatus.setVisibility(View.VISIBLE); + notificationStatus.setImageResource(R.drawable.ic_notifications_off_grey600_24dp); + } else if (muted_till >= System.currentTimeMillis()) { + notificationStatus.setVisibility(View.VISIBLE); + notificationStatus.setImageResource(R.drawable.ic_notifications_paused_grey600_24dp); + } else if (conversation.alwaysNotify()) { + notificationStatus.setVisibility(View.GONE); + } else { + notificationStatus.setVisibility(View.VISIBLE); + notificationStatus.setImageResource(R.drawable.ic_notifications_none_grey600_24dp); + } + mTimestamp.setText(UIHelper.readableTimeDifference(activity,conversation.getLatestMessage().getTimeSent())); ImageView profilePicture = (ImageView) view.findViewById(R.id.conversation_image); loadAvatar(conversation,profilePicture); diff --git a/src/main/res/drawable-hdpi/ic_notifications_grey600_24dp.png b/src/main/res/drawable-hdpi/ic_notifications_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..96b329c4a --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_notifications_grey600_24dp.png diff --git a/src/main/res/drawable-hdpi/ic_notifications_none_grey600_24dp.png b/src/main/res/drawable-hdpi/ic_notifications_none_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..6cd4dfc90 --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_notifications_none_grey600_24dp.png diff --git a/src/main/res/drawable-hdpi/ic_notifications_off_grey600_24dp.png b/src/main/res/drawable-hdpi/ic_notifications_off_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..09ebc5d25 --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_notifications_off_grey600_24dp.png diff --git a/src/main/res/drawable-hdpi/ic_notifications_paused_grey600_24dp.png b/src/main/res/drawable-hdpi/ic_notifications_paused_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..e92d43acf --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_notifications_paused_grey600_24dp.png diff --git a/src/main/res/drawable-mdpi/ic_notifications_grey600_24dp.png b/src/main/res/drawable-mdpi/ic_notifications_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..d6c20c203 --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_notifications_grey600_24dp.png diff --git a/src/main/res/drawable-mdpi/ic_notifications_none_grey600_24dp.png b/src/main/res/drawable-mdpi/ic_notifications_none_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..3e8b0805c --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_notifications_none_grey600_24dp.png diff --git a/src/main/res/drawable-mdpi/ic_notifications_off_grey600_24dp.png b/src/main/res/drawable-mdpi/ic_notifications_off_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..af3b63215 --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_notifications_off_grey600_24dp.png diff --git a/src/main/res/drawable-mdpi/ic_notifications_paused_grey600_24dp.png b/src/main/res/drawable-mdpi/ic_notifications_paused_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..9d6308d2c --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_notifications_paused_grey600_24dp.png diff --git a/src/main/res/drawable-xhdpi/ic_notifications_grey600_24dp.png b/src/main/res/drawable-xhdpi/ic_notifications_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..d441dc7c9 --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_notifications_grey600_24dp.png diff --git a/src/main/res/drawable-xhdpi/ic_notifications_none_grey600_24dp.png b/src/main/res/drawable-xhdpi/ic_notifications_none_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..1123cea43 --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_notifications_none_grey600_24dp.png diff --git a/src/main/res/drawable-xhdpi/ic_notifications_off_grey600_24dp.png b/src/main/res/drawable-xhdpi/ic_notifications_off_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..aef303a0d --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_notifications_off_grey600_24dp.png diff --git a/src/main/res/drawable-xhdpi/ic_notifications_paused_grey600_24dp.png b/src/main/res/drawable-xhdpi/ic_notifications_paused_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..c68bedd38 --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_notifications_paused_grey600_24dp.png diff --git a/src/main/res/drawable-xxhdpi/ic_notifications_grey600_24dp.png b/src/main/res/drawable-xxhdpi/ic_notifications_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..7d58d25d8 --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_notifications_grey600_24dp.png diff --git a/src/main/res/drawable-xxhdpi/ic_notifications_none_grey600_24dp.png b/src/main/res/drawable-xxhdpi/ic_notifications_none_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..b8772d377 --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_notifications_none_grey600_24dp.png diff --git a/src/main/res/drawable-xxhdpi/ic_notifications_off_grey600_24dp.png b/src/main/res/drawable-xxhdpi/ic_notifications_off_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..e627b30a8 --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_notifications_off_grey600_24dp.png diff --git a/src/main/res/drawable-xxhdpi/ic_notifications_paused_grey600_24dp.png b/src/main/res/drawable-xxhdpi/ic_notifications_paused_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..e38f52179 --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_notifications_paused_grey600_24dp.png diff --git a/src/main/res/drawable-xxxhdpi/ic_notifications_grey600_24dp.png b/src/main/res/drawable-xxxhdpi/ic_notifications_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..98dff2f3c --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_notifications_grey600_24dp.png diff --git a/src/main/res/drawable-xxxhdpi/ic_notifications_none_grey600_24dp.png b/src/main/res/drawable-xxxhdpi/ic_notifications_none_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..ffdb15a83 --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_notifications_none_grey600_24dp.png diff --git a/src/main/res/drawable-xxxhdpi/ic_notifications_off_grey600_24dp.png b/src/main/res/drawable-xxxhdpi/ic_notifications_off_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..ab65f4b22 --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_notifications_off_grey600_24dp.png diff --git a/src/main/res/drawable-xxxhdpi/ic_notifications_paused_grey600_24dp.png b/src/main/res/drawable-xxxhdpi/ic_notifications_paused_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..53162e569 --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_notifications_paused_grey600_24dp.png diff --git a/src/main/res/layout/activity_muc_details.xml b/src/main/res/layout/activity_muc_details.xml index 1ff6f95d2..6fd62bb36 100644 --- a/src/main/res/layout/activity_muc_details.xml +++ b/src/main/res/layout/activity_muc_details.xml @@ -111,6 +111,34 @@ android:padding="@dimen/image_button_padding" android:src="?attr/icon_settings" /> </RelativeLayout> + + <RelativeLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content"> + <TextView + android:id="@+id/notification_status_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/notify_on_all_messages" + android:layout_centerVertical="true" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + android:layout_alignParentLeft="true" + android:layout_toLeftOf="@+id/notification_status_button" + /> + <ImageButton + android:id="@+id/notification_status_button" + style="?android:attr/buttonStyleSmall" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:background="?android:selectableItemBackground" + android:padding="@dimen/image_button_padding" + android:src="@drawable/ic_notifications_grey600_24dp"/> + </RelativeLayout> + <TableLayout android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/conversation_list_row.xml index 575647f0a..5d69f965a 100644 --- a/src/main/res/layout/conversation_list_row.xml +++ b/src/main/res/layout/conversation_list_row.xml @@ -1,90 +1,111 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:descendantFocusability="blocksDescendants"> + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:descendantFocusability="blocksDescendants"> - <View - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:background="@color/primary"/> + <View + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:background="@color/primary"/> - <FrameLayout - android:id="@+id/swipeable_item" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:background="@color/grey50"> + <FrameLayout + android:id="@+id/swipeable_item" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:background="@color/grey50"> - <RelativeLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:background="?android:selectableItemBackground" - android:orientation="horizontal" - android:padding="8dp" > + <RelativeLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="?android:selectableItemBackground" + android:orientation="horizontal" + android:padding="8dp"> - <com.makeramen.roundedimageview.RoundedImageView - android:id="@+id/conversation_image" - android:layout_width="56dp" - android:layout_height="56dp" - android:layout_alignParentLeft="true" - android:scaleType="centerCrop" - android:background="@drawable/message_border" - android:padding="1dp" - app:riv_corner_radius="2dp" /> + <com.makeramen.roundedimageview.RoundedImageView + android:id="@+id/conversation_image" + android:layout_width="56dp" + android:layout_height="56dp" + android:layout_alignParentLeft="true" + android:scaleType="centerCrop" + android:background="@drawable/message_border" + android:padding="1dp" + app:riv_corner_radius="2dp"/> - <RelativeLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_centerVertical="true" - android:layout_toRightOf="@+id/conversation_image" - android:paddingLeft="8dp" > + <RelativeLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:layout_toRightOf="@+id/conversation_image" + android:paddingLeft="8dp"> - <TextView - android:id="@+id/conversation_name" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignLeft="@+id/conversation_lastwrapper" - android:layout_toLeftOf="@+id/conversation_lastupdate" - android:singleLine="true" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeHeadline" - android:typeface="sans" /> + <TextView + android:id="@+id/conversation_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignLeft="@+id/conversation_lastwrapper" + android:layout_toLeftOf="@+id/conversation_lastupdate" + android:paddingRight="4dp" + android:singleLine="true" + android:text="Awesome groupchat" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeHeadline" + android:typeface="sans"/> - <LinearLayout - android:id="@+id/conversation_lastwrapper" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_below="@id/conversation_name" - android:orientation="vertical" - android:paddingTop="3dp" > + <RelativeLayout + android:id="@+id/conversation_lastwrapper" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/conversation_name" + android:layout_marginTop="4dp"> - <TextView - android:id="@+id/conversation_lastmsg" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:scrollHorizontally="false" - android:singleLine="true" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <LinearLayout android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_toLeftOf="@+id/notification_status" + android:orientation="vertical"> + <TextView + android:id="@+id/conversation_lastmsg" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:scrollHorizontally="false" + android:singleLine="true" + android:text="This is a placeholder text to show the last messages" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody"/> - <ImageView - android:id="@+id/conversation_lastimage" - android:layout_width="fill_parent" - android:layout_height="14dp" - android:background="@color/black87" - android:scaleType="centerCrop" /> - </LinearLayout> + <com.makeramen.roundedimageview.RoundedImageView + android:id="@+id/conversation_lastimage" + android:layout_width="fill_parent" + android:layout_height="36dp" + android:background="@color/black87" + android:scaleType="centerCrop" + android:visibility="gone" + app:riv_corner_radius="2dp"/> + </LinearLayout> + <ImageView + android:id="@+id/notification_status" + android:layout_width="16sp" + android:layout_height="16sp" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:layout_marginLeft="4dp" + android:src="@drawable/ic_notifications_grey600_24dp" + /> + </RelativeLayout> - <TextView - android:id="@+id/conversation_lastupdate" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignBaseline="@+id/conversation_name" - android:layout_alignParentRight="true" - android:gravity="right" - android:textColor="@color/black54" - android:textSize="?attr/TextSizeInfo" /> - </RelativeLayout> - </RelativeLayout> - </FrameLayout> + <TextView + android:id="@+id/conversation_lastupdate" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBaseline="@+id/conversation_name" + android:layout_alignParentRight="true" + android:gravity="right" + android:text="23:42" + android:textColor="@color/black54" + android:textSize="?attr/TextSizeInfo"/> + </RelativeLayout> + </RelativeLayout> + </FrameLayout> </FrameLayout>
\ No newline at end of file diff --git a/src/main/res/values/arrays.xml b/src/main/res/values/arrays.xml index cc68ca424..0f2dbb1a4 100644 --- a/src/main/res/values/arrays.xml +++ b/src/main/res/values/arrays.xml @@ -57,4 +57,16 @@ <item>voice</item> <item>location</item> </string-array> + + <string-array name="picture_compression_values"> + <item>never</item> + <item>auto</item> + <item>always</item> + </string-array> + + <string-array name="picture_compression_entries"> + <item>@string/never</item> + <item>@string/automatically</item> + <item>@string/always</item> + </string-array> </resources> diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index bbbc41534..50ec686e5 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -111,8 +111,6 @@ <string name="pref_vibrate_summary">Also vibrate when a new message arrives</string> <string name="pref_sound">Sound</string> <string name="pref_sound_summary">Play ringtone with notification</string> - <string name="pref_conference_notifications">Notifications in Public Conferences</string> - <string name="pref_conference_notifications_summary">Always notify when a message arrives in a public conference instead of only when highlighted</string> <string name="pref_notification_grace_period">Notification grace period</string> <string name="pref_notification_grace_period_summary">Disable notifications for a short time after a carbon copy was received</string> <string name="pref_advanced_options">Advanced Options</string> @@ -268,7 +266,6 @@ <string name="skip">Skip</string> <string name="disable_notifications">Disable notifications</string> <string name="disable_notifications_for_this_conversation">Disable notifications for this conversation</string> - <string name="notifications_disabled">Notifications are disabled</string> <string name="enable">Enable</string> <string name="conference_requires_password">Conference requires password</string> <string name="enter_password">Enter password</string> @@ -290,7 +287,7 @@ <string name="pref_about_conversations_summary">Build and licensing information</string> <string name="pref_about_message" translatable="false">Pix-Art Messenger is a fork of Conversations. \n\nConversations • the very last word in instant messaging. - \n\nCopyright © 2014 Daniel Gultsch + \n\nCopyright © 2014-2016 Daniel Gultsch \n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -590,4 +587,12 @@ <string name="certificate_sha1">SHA1</string> <string name="certicate_info_not_available">(Not available)</string> <string name="certificate_not_found">No certificate found</string> + <string name="notify_on_all_messages">Notify on all messages</string> + <string name="notify_only_when_highlighted">Notify only when highlighted</string> + <string name="notify_never">Notifications disabled</string> + <string name="notify_paused">Notifications paused</string> + <string name="pref_picture_compression">Compress Pictures</string> + <string name="pref_picture_compression_summary">Resize and compressed pictures</string> + <string name="always">Always</string> + <string name="automatically">Automatically</string> </resources> diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index 4cc22e097..aac580a98 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -15,7 +15,13 @@ android:key="auto_accept_file_size" android:summary="@string/pref_accept_files_summary" android:title="@string/pref_accept_files"/> - + <ListPreference + android:defaultValue="auto" + android:entries="@array/picture_compression_entries" + android:entryValues="@array/picture_compression_values" + android:key="picture_compression" + android:summary="@string/pref_picture_compression_summary" + android:title="@string/pref_picture_compression"/> <CheckBoxPreference android:defaultValue="true" android:key="confirm_messages" @@ -75,19 +81,13 @@ android:summary="@string/pref_sound_summary" android:title="@string/pref_sound"/> - <CheckBoxPreference - android:defaultValue="false" - android:dependency="show_notification" - android:key="always_notify_in_conference" - android:summary="@string/pref_conference_notifications_summary" - android:title="@string/pref_conference_notifications"/> </PreferenceCategory> <PreferenceCategory android:title="@string/pref_ui_options"> <CheckBoxPreference android:defaultValue="false" android:key="use_white_background" - android:title="@string/pref_use_white_background" - android:summary="@string/pref_use_white_background_summary"/> + android:summary="@string/pref_use_white_background_summary" + android:title="@string/pref_use_white_background"/> <CheckBoxPreference android:defaultValue="false" android:key="use_larger_font" @@ -168,13 +168,13 @@ android:title="@string/pref_remove_trusted_certificates_title"/> </PreferenceCategory> <PreferenceCategory - android:title="@string/pref_connection_options" - android:key="connection_options"> + android:key="connection_options" + android:title="@string/pref_connection_options"> <CheckBoxPreference android:defaultValue="false" android:key="use_tor" - android:title="@string/pref_use_tor" - android:summary="@string/pref_use_tor_summary"/> + android:summary="@string/pref_use_tor_summary" + android:title="@string/pref_use_tor"/> </PreferenceCategory> <PreferenceCategory android:title="@string/pref_input_options"> <CheckBoxPreference @@ -207,9 +207,9 @@ android:summary="@string/pref_keep_foreground_service_summary" android:title="@string/pref_keep_foreground_service"/> <eu.siacs.conversations.ui.ExportLogsPreference - android:key="export_logs" - android:title="@string/pref_export_logs" - android:summary="@string/pref_export_logs_summary"/> + android:key="export_logs" + android:summary="@string/pref_export_logs_summary" + android:title="@string/pref_export_logs"/> </PreferenceCategory> </PreferenceScreen> <CheckBoxPreference |