Extend DPAD support.

Allows the hardware DPAD to control more of the UI.

Closes #4989
// FREEBIE
This commit is contained in:
Clam 2015-07-10 01:03:45 +10:00 committed by Moxie Marlinspike
parent b94c72ea7f
commit a8a8ec1d40
20 changed files with 71 additions and 10 deletions

View File

@ -6,5 +6,11 @@
</shape>
<layer-list android:src="@drawable/import_export_item_background_dark" />
</item>
<item android:state_focused="true">
<shape>
<solid android:color="@color/import_export_touch_highlight_dark" />
</shape>
<layer-list android:src="@drawable/import_export_item_background_dark" />
</item>
<item android:drawable="@drawable/import_export_item_background_dark" />
</selector>

View File

@ -6,5 +6,11 @@
</shape>
<layer-list android:src="@drawable/import_export_item_background_light" />
</item>
<item android:state_focused="true">
<shape>
<solid android:color="@color/import_export_touch_highlight_light" />
</shape>
<layer-list android:src="@drawable/import_export_item_background_light" />
</item>
<item android:drawable="@drawable/import_export_item_background_light" />
</selector>

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/textsecure_primary_alpha33" android:state_selected="true" />
</selector>
<item android:drawable="@color/signal_primary_alpha_focus" android:state_focused="true" />
</selector>

View File

@ -2,5 +2,6 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/textsecure_primary_alpha33" android:state_selected="true" />
<item android:drawable="@color/textsecure_primary_alpha33" android:state_pressed="true" />
<item android:drawable="@color/signal_primary_alpha_focus" android:state_focused="true" />
<item android:drawable="@color/conversation_list_item_background_read_light" />
</selector>
</selector>

View File

@ -2,5 +2,6 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/textsecure_primary_alpha33" android:state_selected="true" />
<item android:drawable="@color/textsecure_primary_alpha33" android:state_pressed="true" />
<item android:drawable="@color/signal_primary_alpha_focus" android:state_focused="true" />
<item android:drawable="@color/conversation_list_item_background_read_dark" />
</selector>
</selector>

View File

@ -2,5 +2,6 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/textsecure_primary_alpha33" android:state_selected="true" />
<item android:drawable="@color/textsecure_primary_alpha33" android:state_pressed="true" />
<item android:drawable="@color/signal_primary_alpha_focus" android:state_focused="true" />
<item android:drawable="@color/conversation_list_item_background_unread_light" />
</selector>
</selector>

View File

@ -2,5 +2,6 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/textsecure_primary_alpha33" android:state_selected="true" />
<item android:drawable="@color/textsecure_primary_alpha33" android:state_pressed="true" />
<item android:drawable="@color/signal_primary_alpha_focus" android:state_focused="true" />
<item android:drawable="@color/conversation_list_item_background_unread_dark" />
</selector>
</selector>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@color/signal_primary" />
<item android:state_focused="true" android:drawable="@color/signal_primary" />
<item android:drawable="@color/signal_primary_dark" />
</selector>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@color/touch_highlight" />
<item android:state_focused="true" android:drawable="@color/signal_primary" />
<item android:drawable="@android:color/transparent" />
</selector>
</selector>

View File

@ -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 @@
</LinearLayout>
</merge>
</merge>

View File

@ -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">

View File

@ -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">

View File

@ -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">
<RelativeLayout android:layout_width="match_parent"

View File

@ -4,6 +4,9 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:focusable="true"
android:nextFocusRight="@+id/fab"
android:nextFocusLeft="@+id/container"
android:layout_height="70dp">
<org.thoughtcrime.securesms.components.AvatarImageView

View File

@ -60,7 +60,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:background="?import_export_item_card_background"
android:orientation="vertical">
android:orientation="vertical"
android:focusable="true">
<LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content"

View File

@ -17,6 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?import_export_item_card_background"
android:focusable="true"
android:orientation="vertical">
<LinearLayout android:orientation="horizontal"
@ -60,6 +61,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:background="?import_export_item_card_background"
android:focusable="true"
android:orientation="vertical">
<LinearLayout android:orientation="horizontal"
@ -104,6 +106,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:background="?import_export_item_card_background"
android:focusable="true"
android:orientation="vertical">
<LinearLayout android:orientation="horizontal"

View File

@ -13,7 +13,9 @@
tools:visibility="visible"
android:padding="2dp"
android:gravity="center_vertical"
android:background="?reminder_header_background">
android:focusable="true"
android:nextFocusRight="@+id/cancel"
android:background="@drawable/reminder_background">
<LinearLayout android:id="@+id/reminder"
android:layout_width="0dp"
@ -55,6 +57,9 @@
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="10dp"
android:focusable="true"
android:nextFocusRight="@+id/container"
android:nextFocusLeft="@+id/container"
android:background="@drawable/touch_highlight_background"
android:src="@drawable/ic_close_white_24dp"/>
</LinearLayout>

View File

@ -3,6 +3,7 @@
<color name="signal_primary">#ff2090ea</color>
<color name="signal_primary_dark">#ff1c7ac5</color>
<color name="signal_primary_alpha33">#552090ea</color>
<color name="signal_primary_alpha_focus">#882090ea</color>
<color name="textsecure_primary">@color/signal_primary</color>
<color name="textsecure_primary_dark">@color/signal_primary_dark</color>
@ -49,4 +50,4 @@
<color name="import_export_item_background_shadow_dark">#ff222222</color>
<color name="import_export_touch_highlight_light">#400099cc</color>
<color name="import_export_touch_highlight_dark">#40ffffff</color>
</resources>
</resources>

View File

@ -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);

View File

@ -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() {