Skip to content

Commit

Permalink
Show default settings icon on Android TV.
Browse files Browse the repository at this point in the history
  • Loading branch information
iiordanov committed Mar 31, 2024
1 parent b71d4f0 commit 16edbf9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

abstract public class RemoteConnection implements KeyInputHandler, InputCarriable {

private final static String TAG = "RemoteCanvas";
private final static String TAG = "RemoteConnection";

// Connection parameters
public Connection connection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public class ConnectionGridActivity extends FragmentActivity implements GetTextF
private EditText search;
private boolean togglingMasterPassword = false;
private AppCompatImageButton addNewConnection = null;
private AppCompatImageButton editDefaultSettings = null;

private RateOrShareFragment rateOrShareFragment = new RateOrShareFragment();

Expand Down Expand Up @@ -162,12 +163,9 @@ public void afterTextChanged(Editable s) {
FileUtils.logFilesInPrivateStorage(this);
FileUtils.deletePrivateFileIfExisting(this, ".config/freerdp/licenses");
addNewConnection = findViewById(R.id.addNewConnection);
addNewConnection.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addNewConnection();
}
});
addNewConnection.setOnClickListener(v -> addNewConnection());
editDefaultSettings = findViewById(R.id.editDefaultSettings);
editDefaultSettings.setOnClickListener(v -> editDefaultSettings());
}

private ConnectionLoader getConnectionLoader(Context context) {
Expand Down Expand Up @@ -347,6 +345,10 @@ public void copyLogcat(MenuItem menuItem) {
* @param menuItem
*/
public void editDefaultSettings(MenuItem menuItem) {
editDefaultSettings();
}

public void editDefaultSettings() {
android.util.Log.d(TAG, "editDefaultSettings selected.");
if (Utils.isOpaque(this)) {
Intent intent = new Intent(ConnectionGridActivity.this, GeneralUtils.getClassByName("com.undatech.opaque.AdvancedSettingsActivity"));
Expand Down
20 changes: 17 additions & 3 deletions bVNC/src/main/res/layout/grid_view_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,19 @@
android:layout_weight="0.90"
android:hint="@string/search_connections"
android:padding="10dp"
android:textAppearance="?android:attr/textAppearanceMedium"></EditText>
android:textAppearance="?android:attr/textAppearanceMedium">
</EditText>

<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/editDefaultSettings"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.10"
android:contentDescription="@string/action_edit_default_settings"
android:title="@string/action_edit_default_settings"
android:background="?android:selectableItemBackground"
app:srcCompat="@android:drawable/ic_menu_preferences">
</androidx.appcompat.widget.AppCompatImageButton>

<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/addNewConnection"
Expand All @@ -30,7 +42,8 @@
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>
app:srcCompat="@drawable/ic_add_connection_48">
</androidx.appcompat.widget.AppCompatImageButton>
</LinearLayout>

<GridView
Expand All @@ -39,5 +52,6 @@
android:layout_height="fill_parent"
android:gravity="top|center"
android:numColumns="2"
android:stretchMode="columnWidth"></GridView>
android:stretchMode="columnWidth">
</GridView>
</LinearLayout>
6 changes: 3 additions & 3 deletions bVNC/src/main/res/menu/grid_view_activity_actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@

<item
android:id="@+id/actionEditDefaultSettings"
android:icon="@android:drawable/ic_menu_manage"
android:icon="@android:drawable/ic_menu_preferences"
android:onClick="editDefaultSettings"
android:showAsAction="ifRoom"
android:showAsAction="never"
android:title="@string/action_edit_default_settings"
app:showAsAction="ifRoom"
app:showAsAction="never"
tools:ignore="AppCompatResource" />
</menu>
2 changes: 1 addition & 1 deletion bVNC/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<string name="audio_initialized">Audio initialized</string>
<string name="action_import_settings">Import Settings</string>
<string name="action_new_connection">New Connection ✚</string>
<string name="action_edit_default_settings">Edit Default Settings</string>
<string name="action_edit_default_settings">Edit Default Settings</string>
<string name="action_export_settings">Export Settings</string>
<string name="action_delete_connection">Delete Connection</string>
<string name="action_rate_or_share_app">Get Help, Rate, Share</string>
Expand Down

0 comments on commit 16edbf9

Please sign in to comment.