diff --git a/res/layout/conversation_fragment.xml b/res/layout/conversation_fragment.xml index ac5ba7dd4..9204d31a2 100644 --- a/res/layout/conversation_fragment.xml +++ b/res/layout/conversation_fragment.xml @@ -21,4 +21,16 @@ android:alpha="0" android:visibility="invisible" /> + + diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 72b4318cd..3fa139d1b 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -66,4 +66,7 @@ 20sp 3dp + + 10dp + 10dp diff --git a/res/values/strings.xml b/res/values/strings.xml index befdf1b6c..d623b3583 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -729,6 +729,9 @@ Batch selection mode %s selected + + Scroll to the bottom + Loading countries... Search diff --git a/src/org/thoughtcrime/securesms/ConversationFragment.java b/src/org/thoughtcrime/securesms/ConversationFragment.java index 5db12fd41..69d2f061a 100644 --- a/src/org/thoughtcrime/securesms/ConversationFragment.java +++ b/src/org/thoughtcrime/securesms/ConversationFragment.java @@ -91,6 +91,7 @@ public class ConversationFragment extends Fragment private RecyclerView list; private View loadMoreView; private View composeDivider; + private View scrollToBottomButton; @Override public void onCreate(Bundle icicle) { @@ -102,8 +103,16 @@ public class ConversationFragment extends Fragment @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { final View view = inflater.inflate(R.layout.conversation_fragment, container, false); - list = ViewUtil.findById(view, android.R.id.list); - composeDivider = ViewUtil.findById(view, R.id.compose_divider); + list = ViewUtil.findById(view, android.R.id.list); + composeDivider = ViewUtil.findById(view, R.id.compose_divider); + scrollToBottomButton = ViewUtil.findById(view, R.id.scroll_to_bottom_button); + + scrollToBottomButton.setOnClickListener(new OnClickListener() { + @Override + public void onClick(final View view) { + scrollToBottom(); + } + }); final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, true); list.setHasFixedSize(false); @@ -407,11 +416,14 @@ public class ConversationFragment extends Fragment if (wasAtBottom != currentlyAtBottom) { composeDivider.setVisibility(currentlyAtBottom ? View.INVISIBLE : View.VISIBLE); + scrollToBottomButton.setVisibility(currentlyAtBottom ? View.INVISIBLE : View.VISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { composeDivider.animate().alpha(currentlyAtBottom ? 0 : 1); + scrollToBottomButton.animate().alpha(currentlyAtBottom ? 0 : 1); } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) { composeDivider.setAlpha(currentlyAtBottom ? 0 : 1); + scrollToBottomButton.setAlpha(currentlyAtBottom ? 0 : 1); } wasAtBottom = currentlyAtBottom;