diff --git a/res/drawable-hdpi-v11/ic_dialog_attach.png b/res/drawable-hdpi-v11/ic_dialog_attach.png new file mode 100644 index 0000000000..28507da2df Binary files /dev/null and b/res/drawable-hdpi-v11/ic_dialog_attach.png differ diff --git a/res/drawable-hdpi/ic_dialog_attach.png b/res/drawable-hdpi/ic_dialog_attach.png new file mode 100644 index 0000000000..c01c2b3822 Binary files /dev/null and b/res/drawable-hdpi/ic_dialog_attach.png differ diff --git a/res/drawable-mdpi-v11/ic_dialog_attach.png b/res/drawable-mdpi-v11/ic_dialog_attach.png new file mode 100644 index 0000000000..354c49d386 Binary files /dev/null and b/res/drawable-mdpi-v11/ic_dialog_attach.png differ diff --git a/res/drawable-mdpi/ic_dialog_attach.png b/res/drawable-mdpi/ic_dialog_attach.png new file mode 100644 index 0000000000..1d265aac64 Binary files /dev/null and b/res/drawable-mdpi/ic_dialog_attach.png differ diff --git a/res/drawable-xhdpi-v11/ic_dialog_attach.png b/res/drawable-xhdpi-v11/ic_dialog_attach.png new file mode 100644 index 0000000000..4948feec29 Binary files /dev/null and b/res/drawable-xhdpi-v11/ic_dialog_attach.png differ diff --git a/res/drawable-xhdpi/ic_dialog_attach.png b/res/drawable-xhdpi/ic_dialog_attach.png new file mode 100644 index 0000000000..41cbab203c Binary files /dev/null and b/res/drawable-xhdpi/ic_dialog_attach.png differ diff --git a/res/drawable-xxhdpi-v11/ic_dialog_attach.png b/res/drawable-xxhdpi-v11/ic_dialog_attach.png new file mode 100644 index 0000000000..47c47c44fc Binary files /dev/null and b/res/drawable-xxhdpi-v11/ic_dialog_attach.png differ diff --git a/res/drawable-xxhdpi/ic_dialog_attach.png b/res/drawable-xxhdpi/ic_dialog_attach.png new file mode 100644 index 0000000000..ce7536cbdd Binary files /dev/null and b/res/drawable-xxhdpi/ic_dialog_attach.png differ diff --git a/res/drawable/clickable_card.xml b/res/drawable/clickable_card.xml index 55e1337bda..23b7c7f831 100644 --- a/res/drawable/clickable_card.xml +++ b/res/drawable/clickable_card.xml @@ -2,7 +2,7 @@ - + diff --git a/res/drawable/contact_photo_background.xml b/res/drawable/contact_photo_background.xml new file mode 100644 index 0000000000..ff1153bf2a --- /dev/null +++ b/res/drawable/contact_photo_background.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/res/drawable/emoji_toggle_background.xml b/res/drawable/emoji_toggle_background.xml deleted file mode 100644 index 844ebeadae..0000000000 --- a/res/drawable/emoji_toggle_background.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/res/drawable/ic_dialog_attach.png b/res/drawable/ic_dialog_attach.png deleted file mode 100644 index 66a58b0ba5..0000000000 Binary files a/res/drawable/ic_dialog_attach.png and /dev/null differ diff --git a/res/drawable/send_button_background.xml b/res/drawable/send_button_background.xml deleted file mode 100644 index 5d1fcdbe91..0000000000 --- a/res/drawable/send_button_background.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/res/drawable/touch_highlight_background.xml b/res/drawable/touch_highlight_background.xml new file mode 100644 index 0000000000..de376e0b19 --- /dev/null +++ b/res/drawable/touch_highlight_background.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/res/layout/conversation_activity.xml b/res/layout/conversation_activity.xml index 9a70f06683..8d73513546 100644 --- a/res/layout/conversation_activity.xml +++ b/res/layout/conversation_activity.xml @@ -82,7 +82,7 @@ android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_gravity="center_vertical" - android:background="@drawable/emoji_toggle_background" + android:background="@drawable/touch_highlight_background" android:padding="10dp"/> - - + - #99bebebe + #10000000 \ No newline at end of file diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 8e49386ffd..64a8dacc01 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -58,4 +58,10 @@ + + + + + + \ No newline at end of file diff --git a/res/values/colors.xml b/res/values/colors.xml index b92d49e8b2..38a561c38c 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -11,7 +11,7 @@ #ff33b5e5 - #9933b5e5 + #400099cc #ff284e0a #ff64a926 diff --git a/res/values/strings.xml b/res/values/strings.xml index dc61c598eb..94a0edb17e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -90,8 +90,8 @@ Message details - Transport: %1$s\nSent/Received:%2$s - Sender: %1$s\nTransport: %2$s\nSent: %3$s\nReceived:%4$s + Transport: %1$s\nSent/Received: %2$s + Sender: %1$s\nTransport: %2$s\nSent: %3$s\nReceived: %4$s Confirm Message Delete Are you sure that you want to permanently delete this message? diff --git a/src/org/thoughtcrime/securesms/ConversationListFragment.java b/src/org/thoughtcrime/securesms/ConversationListFragment.java index a602857c7c..ae82b72758 100644 --- a/src/org/thoughtcrime/securesms/ConversationListFragment.java +++ b/src/org/thoughtcrime/securesms/ConversationListFragment.java @@ -107,6 +107,11 @@ public class ConversationListFragment extends SherlockListFragment } else { ConversationListAdapter adapter = (ConversationListAdapter)getListAdapter(); adapter.toggleThreadInBatchSet(headerView.getThreadId()); + + if (adapter.getBatchSelections().size() == 0) { + actionMode.finish(); + } + adapter.notifyDataSetChanged(); } } diff --git a/src/org/thoughtcrime/securesms/components/ForegroundImageView.java b/src/org/thoughtcrime/securesms/components/ForegroundImageView.java new file mode 100644 index 0000000000..123d52edb7 --- /dev/null +++ b/src/org/thoughtcrime/securesms/components/ForegroundImageView.java @@ -0,0 +1,221 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.thoughtcrime.securesms.components; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.view.Gravity; +import android.widget.ImageView; + +import org.thoughtcrime.securesms.R; + +/** + * https://gist.github.com/chrisbanes/9091754 + */ +public class ForegroundImageView extends ImageView { + + private Drawable mForeground; + + private final Rect mSelfBounds = new Rect(); + private final Rect mOverlayBounds = new Rect(); + + private int mForegroundGravity = Gravity.FILL; + + protected boolean mForegroundInPadding = true; + + boolean mForegroundBoundsChanged = false; + + public ForegroundImageView(Context context) { + super(context); + } + + public ForegroundImageView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public ForegroundImageView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ForegroundImageView, + defStyle, 0); + + mForegroundGravity = a.getInt( + R.styleable.ForegroundImageView_android_foregroundGravity, mForegroundGravity); + + final Drawable d = a.getDrawable(R.styleable.ForegroundImageView_android_foreground); + if (d != null) { + setForeground(d); + } + + mForegroundInPadding = a.getBoolean( + R.styleable.ForegroundImageView_android_foregroundInsidePadding, true); + + a.recycle(); + } + + /** + * Describes how the foreground is positioned. + * + * @return foreground gravity. + * + * @see #setForegroundGravity(int) + */ + public int getForegroundGravity() { + return mForegroundGravity; + } + + /** + * Describes how the foreground is positioned. Defaults to START and TOP. + * + * @param foregroundGravity See {@link android.view.Gravity} + * + * @see #getForegroundGravity() + */ + public void setForegroundGravity(int foregroundGravity) { + if (mForegroundGravity != foregroundGravity) { + if ((foregroundGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) { + foregroundGravity |= Gravity.START; + } + + if ((foregroundGravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) { + foregroundGravity |= Gravity.TOP; + } + + mForegroundGravity = foregroundGravity; + + + if (mForegroundGravity == Gravity.FILL && mForeground != null) { + Rect padding = new Rect(); + mForeground.getPadding(padding); + } + + requestLayout(); + } + } + + @Override + protected boolean verifyDrawable(Drawable who) { + return super.verifyDrawable(who) || (who == mForeground); + } + + @Override + public void jumpDrawablesToCurrentState() { + super.jumpDrawablesToCurrentState(); + if (mForeground != null) mForeground.jumpToCurrentState(); + } + + @Override + protected void drawableStateChanged() { + super.drawableStateChanged(); + if (mForeground != null && mForeground.isStateful()) { + mForeground.setState(getDrawableState()); + } + } + + /** + * Supply a Drawable that is to be rendered on top of all of the child + * views in the frame layout. Any padding in the Drawable will be taken + * into account by ensuring that the children are inset to be placed + * inside of the padding area. + * + * @param drawable The Drawable to be drawn on top of the children. + */ + public void setForeground(Drawable drawable) { + if (mForeground != drawable) { + if (mForeground != null) { + mForeground.setCallback(null); + unscheduleDrawable(mForeground); + } + + mForeground = drawable; + + if (drawable != null) { + setWillNotDraw(false); + drawable.setCallback(this); + if (drawable.isStateful()) { + drawable.setState(getDrawableState()); + } + if (mForegroundGravity == Gravity.FILL) { + Rect padding = new Rect(); + drawable.getPadding(padding); + } + } else { + setWillNotDraw(true); + } + requestLayout(); + invalidate(); + } + } + + /** + * Returns the drawable used as the foreground of this FrameLayout. The + * foreground drawable, if non-null, is always drawn on top of the children. + * + * @return A Drawable or null if no foreground was set. + */ + public Drawable getForeground() { + return mForeground; + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + mForegroundBoundsChanged = changed; + } + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); + mForegroundBoundsChanged = true; + } + + @Override + public void draw(Canvas canvas) { + super.draw(canvas); + + if (mForeground != null) { + final Drawable foreground = mForeground; + + if (mForegroundBoundsChanged) { + mForegroundBoundsChanged = false; + final Rect selfBounds = mSelfBounds; + final Rect overlayBounds = mOverlayBounds; + + final int w = getRight() - getLeft(); + final int h = getBottom() - getTop(); + + if (mForegroundInPadding) { + selfBounds.set(0, 0, w, h); + } else { + selfBounds.set(getPaddingLeft(), getPaddingTop(), + w - getPaddingRight(), h - getPaddingBottom()); + } + + Gravity.apply(mForegroundGravity, foreground.getIntrinsicWidth(), + foreground.getIntrinsicHeight(), selfBounds, overlayBounds); + foreground.setBounds(overlayBounds); + } + + foreground.draw(canvas); + } + } + +} \ No newline at end of file