From a8a8ec1d402e10e26bc8cdb939a8aaf7f4e71841 Mon Sep 17 00:00:00 2001 From: Clam Date: Fri, 10 Jul 2015 01:03:45 +1000 Subject: [PATCH] Extend DPAD support. Allows the hardware DPAD to control more of the UI. Closes #4989 // FREEBIE --- res/drawable/clickable_card_dark.xml | 6 ++++++ res/drawable/clickable_card_light.xml | 6 ++++++ res/drawable/conversation_item_background.xml | 3 ++- .../conversation_list_item_read_background.xml | 3 ++- .../conversation_list_item_read_background_dark.xml | 3 ++- .../conversation_list_item_unread_background.xml | 3 ++- ...conversation_list_item_unread_background_dark.xml | 3 ++- res/drawable/reminder_background.xml | 6 ++++++ res/drawable/touch_highlight_background.xml | 3 ++- res/layout/contact_filter_toolbar.xml | 5 ++++- res/layout/contact_selection_list_item.xml | 2 ++ res/layout/conversation_item_received.xml | 3 +++ res/layout/conversation_item_sent.xml | 3 +++ res/layout/conversation_list_item_view.xml | 3 +++ res/layout/export_fragment.xml | 3 ++- res/layout/import_fragment.xml | 3 +++ res/layout/reminder_header.xml | 7 ++++++- res/values/colors.xml | 3 ++- .../securesms/MessageRecipientListItem.java | 1 + .../thoughtcrime/securesms/RegistrationActivity.java | 12 ++++++++++++ 20 files changed, 71 insertions(+), 10 deletions(-) create mode 100644 res/drawable/reminder_background.xml diff --git a/res/drawable/clickable_card_dark.xml b/res/drawable/clickable_card_dark.xml index 567ce86c34..5828c14065 100644 --- a/res/drawable/clickable_card_dark.xml +++ b/res/drawable/clickable_card_dark.xml @@ -6,5 +6,11 @@ + + + + + + diff --git a/res/drawable/clickable_card_light.xml b/res/drawable/clickable_card_light.xml index 68374a0b85..38211ea6e2 100644 --- a/res/drawable/clickable_card_light.xml +++ b/res/drawable/clickable_card_light.xml @@ -6,5 +6,11 @@ + + + + + + diff --git a/res/drawable/conversation_item_background.xml b/res/drawable/conversation_item_background.xml index 7014300913..d4cbc9d842 100644 --- a/res/drawable/conversation_item_background.xml +++ b/res/drawable/conversation_item_background.xml @@ -1,4 +1,5 @@ - \ No newline at end of file + + diff --git a/res/drawable/conversation_list_item_read_background.xml b/res/drawable/conversation_list_item_read_background.xml index 45108a5b76..8ad9fae358 100644 --- a/res/drawable/conversation_list_item_read_background.xml +++ b/res/drawable/conversation_list_item_read_background.xml @@ -2,5 +2,6 @@ + - \ No newline at end of file + diff --git a/res/drawable/conversation_list_item_read_background_dark.xml b/res/drawable/conversation_list_item_read_background_dark.xml index c5153ed188..237d729853 100644 --- a/res/drawable/conversation_list_item_read_background_dark.xml +++ b/res/drawable/conversation_list_item_read_background_dark.xml @@ -2,5 +2,6 @@ + - \ No newline at end of file + diff --git a/res/drawable/conversation_list_item_unread_background.xml b/res/drawable/conversation_list_item_unread_background.xml index cede161f7c..2f11d8cc99 100644 --- a/res/drawable/conversation_list_item_unread_background.xml +++ b/res/drawable/conversation_list_item_unread_background.xml @@ -2,5 +2,6 @@ + - \ No newline at end of file + diff --git a/res/drawable/conversation_list_item_unread_background_dark.xml b/res/drawable/conversation_list_item_unread_background_dark.xml index e6ae4638c8..bf0b92d290 100644 --- a/res/drawable/conversation_list_item_unread_background_dark.xml +++ b/res/drawable/conversation_list_item_unread_background_dark.xml @@ -2,5 +2,6 @@ + - \ No newline at end of file + diff --git a/res/drawable/reminder_background.xml b/res/drawable/reminder_background.xml new file mode 100644 index 0000000000..349f949c23 --- /dev/null +++ b/res/drawable/reminder_background.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/res/drawable/touch_highlight_background.xml b/res/drawable/touch_highlight_background.xml index de376e0b19..8089a02808 100644 --- a/res/drawable/touch_highlight_background.xml +++ b/res/drawable/touch_highlight_background.xml @@ -1,5 +1,6 @@ + - \ No newline at end of file + diff --git a/res/layout/contact_filter_toolbar.xml b/res/layout/contact_filter_toolbar.xml index 19003526f8..07544d3094 100644 --- a/res/layout/contact_filter_toolbar.xml +++ b/res/layout/contact_filter_toolbar.xml @@ -47,6 +47,7 @@ android:layout_gravity="center_vertical" android:gravity="center_vertical" android:clickable="true" + android:focusable="true" android:background="@drawable/circle_touch_highlight_background" android:src="@drawable/ic_dialpad_white_24dp" /> @@ -57,6 +58,7 @@ android:gravity="center_vertical" android:clickable="true" android:visibility="gone" + android:focusable="true" android:background="@drawable/circle_touch_highlight_background" android:src="@drawable/ic_keyboard_white_24dp" /> @@ -67,6 +69,7 @@ android:gravity="center_vertical" android:clickable="true" android:visibility="gone" + android:focusable="true" android:background="@drawable/circle_touch_highlight_background" android:src="@drawable/ic_clear_white_24dp" /> @@ -76,4 +79,4 @@ - \ No newline at end of file + diff --git a/res/layout/contact_selection_list_item.xml b/res/layout/contact_selection_list_item.xml index 3ed8508104..51de436697 100644 --- a/res/layout/contact_selection_list_item.xml +++ b/res/layout/contact_selection_list_item.xml @@ -8,6 +8,8 @@ android:layout_height="?android:attr/listPreferredItemHeight" android:orientation="horizontal" android:gravity="center_vertical" + android:focusable="true" + android:background="@drawable/conversation_item_background" android:paddingLeft="48dp" android:paddingRight="20dp"> diff --git a/res/layout/conversation_item_received.xml b/res/layout/conversation_item_received.xml index bb58816d13..ace096b692 100644 --- a/res/layout/conversation_item_received.xml +++ b/res/layout/conversation_item_received.xml @@ -6,6 +6,9 @@ android:paddingRight="10dip" android:orientation="vertical" android:background="@drawable/conversation_item_background" + android:focusable="true" + android:nextFocusLeft="@+id/container" + android:nextFocusRight="@+id/embedded_text_editor" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto"> diff --git a/res/layout/conversation_item_sent.xml b/res/layout/conversation_item_sent.xml index 5cb9cf0065..e1f45c4fd8 100644 --- a/res/layout/conversation_item_sent.xml +++ b/res/layout/conversation_item_sent.xml @@ -7,6 +7,9 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" + android:focusable="true" + android:nextFocusLeft="@id/container" + android:nextFocusRight="@id/embedded_text_editor" android:background="@drawable/conversation_item_background"> + android:orientation="vertical" + android:focusable="true"> + android:focusable="true" + android:nextFocusRight="@+id/cancel" + android:background="@drawable/reminder_background"> diff --git a/res/values/colors.xml b/res/values/colors.xml index 60011e75cd..9f1d17494d 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -3,6 +3,7 @@ #ff2090ea #ff1c7ac5 #552090ea + #882090ea @color/signal_primary @color/signal_primary_dark @@ -49,4 +50,4 @@ #ff222222 #400099cc #40ffffff - \ No newline at end of file + diff --git a/src/org/thoughtcrime/securesms/MessageRecipientListItem.java b/src/org/thoughtcrime/securesms/MessageRecipientListItem.java index c3c81741f2..48ea133fb7 100644 --- a/src/org/thoughtcrime/securesms/MessageRecipientListItem.java +++ b/src/org/thoughtcrime/securesms/MessageRecipientListItem.java @@ -109,6 +109,7 @@ public class MessageRecipientListItem extends RelativeLayout } else if (networkFailure != null || (!isPushGroup && record.isFailed())) { resendButton.setVisibility(View.VISIBLE); resendButton.setEnabled(true); + resendButton.requestFocus(); conflictButton.setVisibility(View.GONE); errorText = getContext().getString(R.string.MessageDetailsRecipient_failed_to_send); diff --git a/src/org/thoughtcrime/securesms/RegistrationActivity.java b/src/org/thoughtcrime/securesms/RegistrationActivity.java index cc7c8e031e..c4cb065148 100644 --- a/src/org/thoughtcrime/securesms/RegistrationActivity.java +++ b/src/org/thoughtcrime/securesms/RegistrationActivity.java @@ -9,6 +9,7 @@ import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.util.Log; +import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.widget.ArrayAdapter; @@ -120,6 +121,17 @@ public class RegistrationActivity extends BaseActionBarActivity { return true; } }); + this.countrySpinner.setOnKeyListener(new View.OnKeyListener() { + @Override + public boolean onKey(View v, int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER && event.getAction() == KeyEvent.ACTION_UP) { + Intent intent = new Intent(RegistrationActivity.this, CountrySelectionActivity.class); + startActivityForResult(intent, PICK_COUNTRY); + return true; + } + return false; + } + }); } private void initializeNumber() {