Replace Codec button with Context button on remote.

Move Codec button to long click on Info button.
This commit is contained in:
Synced Synapse 2015-02-16 23:40:51 +00:00
parent b57ae03a2f
commit 9466d9e0a8
14 changed files with 152 additions and 29 deletions

View File

@ -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<String> 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<String> clickAction,
final ApiMethod<String> 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;
}
});
}
}
/**

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -122,19 +122,19 @@
android:gravity="center_horizontal">
<ImageView
android:id="@+id/codec_info"
android:id="@+id/context"
android:layout_width="@dimen/remote_icon_size"
android:layout_height="@dimen/remote_icon_size"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:src="?attr/iconCodec"
android:src="?attr/iconContext"
android:contentDescription="@string/codec_info"/>
<ImageView
android:id="@+id/up"
android:layout_width="@dimen/remote_icon_size"
android:layout_height="@dimen/remote_icon_size"
android:layout_toRightOf="@id/codec_info"
android:layout_alignTop="@id/codec_info"
android:layout_toRightOf="@id/context"
android:layout_alignTop="@id/context"
android:src="?attr/iconUp"
android:contentDescription="@string/up"/>
<ImageView
@ -142,7 +142,7 @@
android:layout_width="@dimen/remote_icon_size"
android:layout_height="@dimen/remote_icon_size"
android:layout_toRightOf="@id/up"
android:layout_alignTop="@id/codec_info"
android:layout_alignTop="@id/context"
android:src="?attr/iconInfo"
android:contentDescription="@string/info"/>
@ -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"/>
<ImageView

View File

@ -153,19 +153,19 @@
android:gravity="center_horizontal">
<ImageView
android:id="@+id/codec_info"
android:id="@+id/context"
android:layout_width="@dimen/remote_icon_size"
android:layout_height="@dimen/remote_icon_size"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:src="?attr/iconCodec"
android:src="?attr/iconContext"
android:contentDescription="@string/codec_info"/>
<ImageView
android:id="@+id/up"
android:layout_width="@dimen/remote_icon_size"
android:layout_height="@dimen/remote_icon_size"
android:layout_toRightOf="@id/codec_info"
android:layout_alignTop="@id/codec_info"
android:layout_toRightOf="@id/context"
android:layout_alignTop="@id/context"
android:src="?attr/iconUp"
android:contentDescription="@string/up"/>
<ImageView
@ -173,7 +173,7 @@
android:layout_width="@dimen/remote_icon_size"
android:layout_height="@dimen/remote_icon_size"
android:layout_toRightOf="@id/up"
android:layout_alignTop="@id/codec_info"
android:layout_alignTop="@id/context"
android:src="?attr/iconInfo"
android:contentDescription="@string/info"/>
@ -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"/>
<ImageView

View File

@ -138,6 +138,7 @@
<string name="select">Select</string>
<string name="info">Info</string>
<string name="codec_info">Codec</string>
<string name="context">Context</string>
<string name="osd">Menu</string>
<string name="back">Back</string>

View File

@ -69,7 +69,7 @@
<item name="iconInfo">@drawable/remote_info_white</item>
<item name="iconBack">@drawable/remote_back_white</item>
<item name="iconMenu">@drawable/remote_menu_white</item>
<item name="iconCodec">@drawable/remote_codec_white</item>
<item name="iconContext">@drawable/remote_context_white</item>
<item name="iconLeft">@drawable/remote_left_white</item>
<item name="iconRight">@drawable/remote_right_white</item>
@ -173,7 +173,7 @@
<item name="iconInfo">@drawable/remote_info_black</item>
<item name="iconBack">@drawable/remote_back_black</item>
<item name="iconMenu">@drawable/remote_menu_black</item>
<item name="iconCodec">@drawable/remote_codec_black</item>
<item name="iconContext">@drawable/remote_context_black</item>
<item name="iconLeft">@drawable/remote_left_black</item>
<item name="iconRight">@drawable/remote_right_black</item>

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="288"
height="288"
id="svg2"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="remote_codec.svg">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 144 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="288 : 144 : 1"
inkscape:persp3d-origin="144 : 96 : 1"
id="perspective3804" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="12.564171"
inkscape:cy="130.65863"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1920"
inkscape:window-height="1150"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid2985"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
spacingx="6px"
spacingy="6px" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-764.36218)">
<text
xml:space="preserve"
style="font-size:39.99984741px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
x="-595.51642"
y="783.80695"
id="text2985"
sodipodi:linespacing="125%"
transform="matrix(0.70710679,-0.70710677,0.70710679,0.70710677,0,0)"><tspan
sodipodi:role="line"
id="tspan2987"
x="-595.51642"
y="783.80695"
style="font-size:39.99984741px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;font-family:Roboto Condensed;-inkscape-font-specification:'Roboto Condensed, Bold'">CNTXT</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB