Commit b8cdfe5a authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Keyboard navigation in advanced options

parent 50690ffa
......@@ -42,7 +42,9 @@
android:layout_toRightOf="@+id/playback_speed_title"
android:layout_toLeftOf="@+id/playback_speed_reset"
android:progressDrawable="@drawable/po_seekbar"
android:thumb="@drawable/seekbar_thumb"/>
android:splitTrack="false"
android:thumb="@drawable/seekbar_thumb"
android:focusable="true"/>
<TextView
android:id="@+id/seek_beginning"
......@@ -73,7 +75,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="1x"/>
android:text="1x"
android:focusable="true" />
<!-- Sleep Timer-->
<ImageView
android:id="@+id/sleep_timer_icon"
......@@ -101,7 +104,8 @@
android:layout_toRightOf="@+id/sleep_timer_title"
android:layout_alignLeft="@+id/seek_beginning"
android:text="none_set"
android:clickable="true"/>
android:clickable="true"
android:focusable="true"/>
<TextView
android:id="@+id/sleep_timer_cancel"
android:layout_width="wrap_content"
......@@ -112,7 +116,8 @@
android:layout_marginTop="10dp"
android:layout_toRightOf="@+id/sleep_timer_value"
android:text="@string/sleep_cancel"
android:clickable="true"/>
android:clickable="true"
android:focusable="true"/>
<!-- Jump to position -->
<ImageView
android:id="@+id/jump_icon"
......@@ -130,6 +135,8 @@
android:layout_below="@+id/playback_speed_value"
android:layout_marginTop="10dp"
android:layout_alignRight="@+id/playback_speed_reset"
android:text="@string/jump_to_time" />
android:text="@string/jump_to_time"
android:clickable="true"
android:focusable="true"/>
</RelativeLayout>
......@@ -28,6 +28,8 @@ import android.app.TimePickerDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
......@@ -72,7 +74,9 @@ public class AdvOptionsDialog extends DialogFragment{
private ImageView mJumpIcon;
private TextView mJumpTitle;
private static AdvOptionsDialog sInstance;
private int mTextColor;
public AdvOptionsDialog() {}
......@@ -113,9 +117,14 @@ public class AdvOptionsDialog extends DialogFragment{
mJumpIcon.setOnClickListener(mJumpListener);
mJumpTitle.setOnClickListener(mJumpListener);
mReset.setOnFocusChangeListener(mFocusListener);
mSleepTime.setOnFocusChangeListener(mFocusListener);
mSleepCancel.setOnFocusChangeListener(mFocusListener);
mJumpTitle.setOnFocusChangeListener(mFocusListener);
getDialog().setCancelable(true);
mHandler.sendEmptyMessage(TOGGLE_CANCEL);
mTextColor = mSleepTitle.getCurrentTextColor();
return root;
}
......@@ -161,6 +170,15 @@ public class AdvOptionsDialog extends DialogFragment{
}
};
View.OnFocusChangeListener mFocusListener = new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (v instanceof TextView)
((TextView) v).setTextColor(v.hasFocus() ?
sInstance.getResources().getColor(R.color.darkorange) : mTextColor);
}
};
private void showTimePicker(int action) {
DialogFragment newFragment = new TimePickerDialogFragment();
Bundle args = new Bundle();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment