Skip to content

Commit

Permalink
Easier navigation of connection setup screen for Android TV devices.
Browse files Browse the repository at this point in the history
  • Loading branch information
iiordanov committed Mar 30, 2024
1 parent f3e0753 commit b7a122b
Show file tree
Hide file tree
Showing 14 changed files with 230 additions and 32 deletions.
18 changes: 18 additions & 0 deletions bVNC/src/main/java/com/iiordanov/bVNC/MainConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,16 @@ public void saveAsCopy(MenuItem item) {
finish();
}


public void showConnectionScreenHelp(View view) {
showConnectionScreenHelp();
}

public void showConnectionScreenHelp(MenuItem item) {
showConnectionScreenHelp();
}

public void showConnectionScreenHelp() {
Log.d(TAG, "showConnectionScreenHelp called");
Log.d(TAG, "Showing connection screen help.");
Utils.createConnectionScreenDialog(this);
Expand All @@ -546,4 +555,13 @@ protected static void logAndPrintStacktrace(Exception e) {
e.printStackTrace();
Log.d(TAG, "Ignoring Exception: " + e);
}

public void save(int resource) {
Log.d(TAG, "save called");
if (ipText.getText().length() != 0 && portText.getText().length() != 0) {
saveConnectionAndCloseLayout();
} else {
Toast.makeText(this, resource, Toast.LENGTH_LONG).show();
}
}
}
13 changes: 5 additions & 8 deletions bVNC/src/main/java/com/iiordanov/bVNC/aRDP.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
Expand All @@ -30,7 +29,6 @@
import android.widget.LinearLayout;
import android.widget.RadioGroup;
import android.widget.Spinner;
import android.widget.Toast;
import android.widget.ToggleButton;

import com.iiordanov.bVNC.dialogs.IntroTextDialog;
Expand Down Expand Up @@ -317,12 +315,11 @@ public void setRemoteSoundTypeFromSelected(int type) {
groupRemoteSoundType.check(id);
}

public void save(View item) {
save(R.string.rdp_server_empty);
}

public void save(MenuItem item) {
Log.d(TAG, "save called");
if (ipText.getText().length() != 0 && portText.getText().length() != 0) {
saveConnectionAndCloseLayout();
} else {
Toast.makeText(this, R.string.rdp_server_empty, Toast.LENGTH_LONG).show();
}
save(R.string.rdp_server_empty);
}
}
10 changes: 9 additions & 1 deletion bVNC/src/main/java/com/iiordanov/bVNC/aSPICE.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,20 @@ public void toggleEnableSound(View view) {
selected.setEnableSound(b.isChecked());
}

public void save(View item) {
save(R.string.spice_server_empty);
}

public void save(MenuItem item) {
save(R.string.spice_server_empty);
}

public void save(int resource) {
if (ipText.getText().length() != 0
&& (portText.getText().length() != 0 || tlsPort.getText().length() != 0)) {
saveConnectionAndCloseLayout();
} else {
Toast.makeText(this, R.string.spice_server_empty, Toast.LENGTH_LONG).show();
Toast.makeText(this, resource, Toast.LENGTH_LONG).show();
}
}

Expand Down
12 changes: 5 additions & 7 deletions bVNC/src/main/java/com/iiordanov/bVNC/bVNC.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import android.widget.RadioGroup;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

import com.iiordanov.bVNC.dialogs.AutoXCustomizeDialog;
import com.iiordanov.bVNC.dialogs.RepeaterDialog;
Expand Down Expand Up @@ -282,12 +281,11 @@ protected void updateSelectedFromView() {
}
}

public void save(View item) {
save(R.string.vnc_server_empty);
}

public void save(MenuItem item) {
Log.d(TAG, "save called");
if (ipText.getText().length() != 0 && portText.getText().length() != 0) {
saveConnectionAndCloseLayout();
} else {
Toast.makeText(this, R.string.vnc_server_empty, Toast.LENGTH_LONG).show();
}
save(R.string.vnc_server_empty);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,29 @@ public boolean onOptionsItemSelected(MenuItem menuItem) {
return true;
}

public void showConnectionScreenHelp(View view) {
showConnectionScreenHelp();
}

public void showConnectionScreenHelp(MenuItem item) {
showConnectionScreenHelp();
}

public void showConnectionScreenHelp() {
Log.d(TAG, "Showing connection screen help.");
Utils.createConnectionScreenDialog(this);
}


public void save(View view) {
save();
}

public void save(MenuItem item) {
save();
}

public void save() {
String u = user.getText().toString();
String h = hostname.getText().toString();

Expand Down
26 changes: 25 additions & 1 deletion bVNC/src/main/res/layout-large/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,36 @@
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>


<Button
android:id="@+id/copyLogcat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/copy_logcat"
android:textAppearance="?android:attr/textAppearanceLarge" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="@+id/helpButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:onClick="showConnectionScreenHelp"
android:text="@string/menu_help" />
<Button
android:id="@+id/saveButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="save"
android:text="@string/save_button" />
</LinearLayout>

</LinearLayout>

</ScrollView>
24 changes: 23 additions & 1 deletion bVNC/src/main/res/layout-large/main_rdp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -691,12 +691,34 @@
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>


<Button
android:id="@+id/copyLogcat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/copy_logcat"
android:textAppearance="?android:attr/textAppearanceLarge" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="@+id/helpButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:onClick="showConnectionScreenHelp"
android:text="@string/menu_help" />
<Button
android:id="@+id/saveButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="save"
android:text="@string/save_button" />
</LinearLayout>
</LinearLayout>
</ScrollView>
24 changes: 23 additions & 1 deletion bVNC/src/main/res/layout-large/main_spice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,34 @@
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>


<Button
android:id="@+id/copyLogcat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/copy_logcat"
android:textAppearance="?android:attr/textAppearanceLarge" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="@+id/helpButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:onClick="showConnectionScreenHelp"
android:text="@string/menu_help" />
<Button
android:id="@+id/saveButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="save"
android:text="@string/save_button" />
</LinearLayout>
</LinearLayout>
</ScrollView>
24 changes: 24 additions & 0 deletions bVNC/src/main/res/layout/connection_setup_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,29 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/advanced_settings" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="@+id/helpButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:onClick="showConnectionScreenHelp"
android:text="@string/menu_help" />
<Button
android:id="@+id/saveButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="save"
android:text="@string/save_button" />
</LinearLayout>

</TableLayout>
</FrameLayout>
1 change: 1 addition & 0 deletions bVNC/src/main/res/layout/grid_view_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
android:layout_weight="0.10"
android:contentDescription="@string/action_new_connection"
android:title="@string/action_new_connection"
android:background="?android:selectableItemBackground"
app:srcCompat="@drawable/ic_add_connection_48"></androidx.appcompat.widget.AppCompatImageButton>
</LinearLayout>

Expand Down
24 changes: 23 additions & 1 deletion bVNC/src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,34 @@
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>


<Button
android:id="@+id/copyLogcat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/copy_logcat"
android:textAppearance="?android:attr/textAppearanceMedium" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="@+id/helpButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:onClick="showConnectionScreenHelp"
android:text="@string/menu_help" />
<Button
android:id="@+id/saveButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="save"
android:text="@string/save_button" />
</LinearLayout>
</LinearLayout>
</ScrollView>
23 changes: 23 additions & 0 deletions bVNC/src/main/res/layout/main_rdp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,28 @@
android:layout_height="wrap_content"
android:text="@string/copy_logcat"
android:textAppearance="?android:attr/textAppearanceMedium" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="@+id/helpButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:onClick="showConnectionScreenHelp"
android:text="@string/menu_help" />
<Button
android:id="@+id/saveButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="save"
android:text="@string/save_button" />
</LinearLayout>
</LinearLayout>
</ScrollView>
24 changes: 23 additions & 1 deletion bVNC/src/main/res/layout/main_spice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,34 @@
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>


<Button
android:id="@+id/copyLogcat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/copy_logcat"
android:textAppearance="?android:attr/textAppearanceMedium" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="@+id/helpButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:onClick="showConnectionScreenHelp"
android:text="@string/menu_help" />
<Button
android:id="@+id/saveButton"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="save"
android:text="@string/save_button" />
</LinearLayout>
</LinearLayout>
</ScrollView>
Loading

0 comments on commit b7a122b

Please sign in to comment.