diff options
author | steckbrief <steckbrief@chefmail.de> | 2015-09-02 21:29:23 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2015-09-02 21:29:23 +0200 |
commit | 38dfb6d6c742b6a1f88308369036918919fa34d2 (patch) | |
tree | e2c02b5d0b654a8203d4817f99111e3e17da77c4 /src/main | |
parent | 659875959750aae9af0a1a253f1af16c1a770198 (diff) |
Fixes FS#49: Highlight the selected conversation in list
Diffstat (limited to 'src/main')
3 files changed, 14 insertions, 10 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java index cff681a9..2aeeb9c7 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java +++ b/src/main/java/de/thedevstack/conversationsplus/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/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java index 2da7bea3..d6b944d0 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java @@ -8,6 +8,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; @@ -49,11 +50,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()) { @@ -65,7 +67,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"; 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 |