diff --git a/app/src/main/java/com/syncedsynapse/kore2/ui/RemoteFragment.java b/app/src/main/java/com/syncedsynapse/kore2/ui/RemoteFragment.java index 2b70365..7b0ce45 100644 --- a/app/src/main/java/com/syncedsynapse/kore2/ui/RemoteFragment.java +++ b/app/src/main/java/com/syncedsynapse/kore2/ui/RemoteFragment.java @@ -19,6 +19,7 @@ import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; import android.view.LayoutInflater; +import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; @@ -102,7 +103,7 @@ public class RemoteFragment extends Fragment @InjectView(R.id.down) ImageView downButton; @InjectView(R.id.back) ImageView backButton; @InjectView(R.id.info) ImageView infoButton; - @InjectView(R.id.codec_info) ImageView codecInfoButton; + @InjectView(R.id.context) ImageView contextButton; @InjectView(R.id.osd) ImageView osdButton; @InjectView(R.id.art) ImageView thumbnail; @@ -115,6 +116,8 @@ public class RemoteFragment extends Fragment private Animation buttonInAnim; private Animation buttonOutAnim; + // Touch listener that provides touch feedbacl + private View.OnTouchListener feedbackTouckListener; @Override public void onCreate(Bundle savedInstanceState) { @@ -124,6 +127,23 @@ public class RemoteFragment extends Fragment buttonInAnim = AnimationUtils.loadAnimation(getActivity(), R.anim.button_in); buttonOutAnim = AnimationUtils.loadAnimation(getActivity(), R.anim.button_out); + + feedbackTouckListener = new View.OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent event) { + switch (event.getAction()) { + case MotionEvent.ACTION_DOWN: + buttonInAnim.setFillAfter(true); + v.startAnimation(buttonInAnim); + break; + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_CANCEL: + v.startAnimation(buttonOutAnim); + break; + } + return false; + } + }; } @Override @@ -137,12 +157,13 @@ public class RemoteFragment extends Fragment setupRepeatButton(upButton, new Input.Up()); setupRepeatButton(downButton, new Input.Down()); - setupNoRepeatButton(selectButton, new Input.Select()); - - setupNoRepeatButton(backButton, new Input.Back()); - setupNoRepeatButton(infoButton, new Input.ExecuteAction(Input.ExecuteAction.INFO)); - setupNoRepeatButton(osdButton, new Input.ExecuteAction(Input.ExecuteAction.OSD)); - setupNoRepeatButton(codecInfoButton, new Input.ExecuteAction(Input.ExecuteAction.CODECINFO)); + setupNoRepeatButton(selectButton, new Input.Select(), null); + setupNoRepeatButton(backButton, new Input.Back(), null); + setupNoRepeatButton(infoButton, + new Input.ExecuteAction(Input.ExecuteAction.INFO), + new Input.ExecuteAction(Input.ExecuteAction.CODECINFO)); + setupNoRepeatButton(osdButton, new Input.ExecuteAction(Input.ExecuteAction.OSD), null); + setupNoRepeatButton(contextButton, new Input.ExecuteAction(Input.ExecuteAction.CONTEXTMENU), null); // // Padd main content view to account for bottom system bar // UIUtils.setPaddingForSystemBars(getActivity(), root, false, false, true); @@ -192,14 +213,28 @@ public class RemoteFragment extends Fragment }, buttonInAnim, buttonOutAnim)); } - private void setupNoRepeatButton(View button, final ApiMethod action) { - button.setOnTouchListener(new RepeatListener(-1, -1, - new View.OnClickListener() { - @Override - public void onClick(View v) { - action.execute(hostManager.getConnection(), defaultActionCallback, callbackHandler); - } - }, buttonInAnim, buttonOutAnim)); + private void setupNoRepeatButton(View button, + final ApiMethod clickAction, + final ApiMethod longClickAction) { + // Set animation + button.setOnTouchListener(feedbackTouckListener); + if (clickAction != null) { + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + clickAction.execute(hostManager.getConnection(), defaultActionCallback, callbackHandler); + } + }); + } + if (longClickAction != null) { + button.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + longClickAction.execute(hostManager.getConnection(), defaultActionCallback, callbackHandler); + return true; + } + }); + } } /** diff --git a/app/src/main/res/drawable-sw600dp-xxhdpi/remote_context_black.png b/app/src/main/res/drawable-sw600dp-xxhdpi/remote_context_black.png new file mode 100644 index 0000000..789bc8a Binary files /dev/null and b/app/src/main/res/drawable-sw600dp-xxhdpi/remote_context_black.png differ diff --git a/app/src/main/res/drawable-sw600dp-xxhdpi/remote_context_white.png b/app/src/main/res/drawable-sw600dp-xxhdpi/remote_context_white.png new file mode 100644 index 0000000..79690a9 Binary files /dev/null and b/app/src/main/res/drawable-sw600dp-xxhdpi/remote_context_white.png differ diff --git a/app/src/main/res/drawable-xxhdpi/remote_context_black.png b/app/src/main/res/drawable-xxhdpi/remote_context_black.png new file mode 100644 index 0000000..813de10 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/remote_context_black.png differ diff --git a/app/src/main/res/drawable-xxhdpi/remote_context_white.png b/app/src/main/res/drawable-xxhdpi/remote_context_white.png new file mode 100644 index 0000000..32783f9 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/remote_context_white.png differ diff --git a/app/src/main/res/layout-land/fragment_remote.xml b/app/src/main/res/layout-land/fragment_remote.xml index 3c6e73d..320c45f 100644 --- a/app/src/main/res/layout-land/fragment_remote.xml +++ b/app/src/main/res/layout-land/fragment_remote.xml @@ -122,19 +122,19 @@ android:gravity="center_horizontal"> @@ -150,7 +150,7 @@ android:id="@+id/left" android:layout_width="@dimen/remote_icon_size" android:layout_height="@dimen/remote_icon_size" - android:layout_below="@id/codec_info" + android:layout_below="@id/context" android:src="?attr/iconLeft" android:contentDescription="@string/left"/> @@ -181,7 +181,7 @@ android:id="@+id/left" android:layout_width="@dimen/remote_icon_size" android:layout_height="@dimen/remote_icon_size" - android:layout_below="@id/codec_info" + android:layout_below="@id/context" android:src="?attr/iconLeft" android:contentDescription="@string/left"/> Select Info Codec + Context Menu Back diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index be9ce27..2fdbda6 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -69,7 +69,7 @@ @drawable/remote_info_white @drawable/remote_back_white @drawable/remote_menu_white - @drawable/remote_codec_white + @drawable/remote_context_white @drawable/remote_left_white @drawable/remote_right_white @@ -173,7 +173,7 @@ @drawable/remote_info_black @drawable/remote_back_black @drawable/remote_menu_black - @drawable/remote_codec_black + @drawable/remote_context_black @drawable/remote_left_black @drawable/remote_right_black diff --git a/art/remote/remote_context.svg b/art/remote/remote_context.svg new file mode 100644 index 0000000..d5c6605 --- /dev/null +++ b/art/remote/remote_context.svg @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + CNTXT + + diff --git a/art/remote/xxhdpi-sw600dp/remote_context_black.png b/art/remote/xxhdpi-sw600dp/remote_context_black.png new file mode 100644 index 0000000..789bc8a Binary files /dev/null and b/art/remote/xxhdpi-sw600dp/remote_context_black.png differ diff --git a/art/remote/xxhdpi-sw600dp/remote_context_white.png b/art/remote/xxhdpi-sw600dp/remote_context_white.png new file mode 100644 index 0000000..79690a9 Binary files /dev/null and b/art/remote/xxhdpi-sw600dp/remote_context_white.png differ diff --git a/art/remote/xxhdpi/remote_context_black.png b/art/remote/xxhdpi/remote_context_black.png new file mode 100644 index 0000000..813de10 Binary files /dev/null and b/art/remote/xxhdpi/remote_context_black.png differ diff --git a/art/remote/xxhdpi/remote_context_white.png b/art/remote/xxhdpi/remote_context_white.png new file mode 100644 index 0000000..32783f9 Binary files /dev/null and b/art/remote/xxhdpi/remote_context_white.png differ