Skip to content

Commit 70804b0

Browse files
committed
Add UDP tooltip
1 parent fc1b8d6 commit 70804b0

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

netcat/src/main/java/com/github/dddpaul/netcat/ui/MainFragment.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import android.widget.Button;
1515
import android.widget.CheckBox;
1616
import android.widget.EditText;
17+
import android.widget.TextView;
18+
import android.widget.Toast;
1719

1820
import com.github.dddpaul.netcat.Constants;
1921
import com.github.dddpaul.netcat.R;
@@ -25,6 +27,7 @@
2527

2628
import butterknife.ButterKnife;
2729
import butterknife.InjectView;
30+
import butterknife.OnCheckedChanged;
2831
import butterknife.OnClick;
2932
import de.greenrobot.event.EventBus;
3033
import events.FragmentEvent;
@@ -49,6 +52,9 @@ public class MainFragment extends Fragment
4952
@InjectView( R.id.c_tcp_udp )
5053
protected CheckBox udpCheckbox;
5154

55+
@InjectView( R.id.tv_udp_tooltip )
56+
protected TextView udpTooltip;
57+
5258
private SharedPreferences prefs;
5359
private Set<String> connectToSet;
5460
private ArrayAdapter<String> connectToArrayAdapter;
@@ -111,6 +117,16 @@ protected void onListenButtonClick()
111117
EventBus.getDefault().post( new FragmentEvent( LISTEN, listenOn ) );
112118
}
113119

120+
@OnCheckedChanged( R.id.c_tcp_udp )
121+
protected void onUdpChecked( boolean checked )
122+
{
123+
if( checked ) {
124+
udpTooltip.setVisibility( View.VISIBLE );
125+
} else {
126+
udpTooltip.setVisibility( View.INVISIBLE );
127+
}
128+
}
129+
114130
@Override
115131
public void onResume()
116132
{

netcat/src/main/res/layout/fragment_main.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,18 @@
106106
android:textAppearance="?android:attr/textAppearanceSmall"
107107
/>
108108

109+
<TextView
110+
android:id="@+id/tv_udp_tooltip"
111+
android:text="@string/label_udp_tooltip"
112+
android:layout_width="wrap_content"
113+
android:layout_height="wrap_content"
114+
android:layout_marginTop="20dp"
115+
android:paddingLeft="5dp"
116+
android:paddingRight="5dp"
117+
android:layout_below="@+id/c_tcp_udp"
118+
android:layout_alignParentLeft="true"
119+
android:layout_alignParentStart="true"
120+
android:visibility="invisible"
121+
/>
122+
109123
</RelativeLayout>

netcat/src/main/res/layout/fragment_result.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
android:layout_width="match_parent"
8686
android:layout_height="match_parent"
8787
android:layout_alignParentLeft="true"
88+
android:layout_alignParentRight="true"
8889
android:layout_alignParentStart="true"
8990
android:layout_alignParentBottom="true"
9091
android:layout_alignParentEnd="true"

netcat/src/main/res/values/strings.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<string name="error_port_format">Digits is expected</string>
2424
<string name="label_text_to_send">Text to send:</string>
2525
<string name="label_received_text">Received text:</string>
26-
<string name="label_tcp_udp">Use UDP instead of TCP (experimental)</string>
26+
<string name="label_tcp_udp">Use UDP instead of TCP</string>
27+
<string name="label_udp_tooltip">Send \"~.\" from remote side to disconnect</string>
2728

2829
</resources>

0 commit comments

Comments
 (0)