Merge "Import translations. DO NOT MERGE ANYWHERE" into main
diff --git a/android/TerminalApp/java/com/android/virtualization/terminal/MainActivity.kt b/android/TerminalApp/java/com/android/virtualization/terminal/MainActivity.kt
index d35b106..f6eeff9 100644
--- a/android/TerminalApp/java/com/android/virtualization/terminal/MainActivity.kt
+++ b/android/TerminalApp/java/com/android/virtualization/terminal/MainActivity.kt
@@ -131,15 +131,19 @@
val intent = Intent(this, SettingsActivity::class.java)
this.startActivity(intent)
}
- if (terminalGuiSupport()) {
- displayMenu?.visibility = View.VISIBLE
- displayMenu?.setEnabled(false)
- displayMenu!!.setOnClickListener {
- val intent = Intent(this, DisplayActivity::class.java)
- intent.flags =
- intent.flags or Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
- this.startActivity(intent)
+ displayMenu?.also {
+ it.visibility = if (terminalGuiSupport()) View.VISIBLE else View.GONE
+ it.setEnabled(false)
+ if (terminalGuiSupport()) {
+ it.setOnClickListener {
+ val intent = Intent(this, DisplayActivity::class.java)
+ intent.flags =
+ intent.flags or
+ Intent.FLAG_ACTIVITY_NEW_TASK or
+ Intent.FLAG_ACTIVITY_CLEAR_TASK
+ this.startActivity(intent)
+ }
}
}
diff --git a/android/TerminalApp/res/layout/activity_headless.xml b/android/TerminalApp/res/layout/activity_headless.xml
index bf84833..b4c013f 100644
--- a/android/TerminalApp/res/layout/activity_headless.xml
+++ b/android/TerminalApp/res/layout/activity_headless.xml
@@ -29,7 +29,7 @@
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
- android:layout_toStartOf="@id/settings_button"
+ android:layout_toStartOf="@id/menu_container"
android:scrollbars="none">
<LinearLayout
@@ -59,23 +59,27 @@
</LinearLayout>
</HorizontalScrollView>
- <Button
- android:id="@+id/settings_button"
- style="?attr/materialIconButtonStyle"
+ <LinearLayout
+ android:id="@+id/menu_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
- android:layout_toStartOf="@id/display_button"
- app:icon="@drawable/ic_settings" />
-
- <Button
- android:id="@+id/display_button"
- style="?attr/materialIconButtonStyle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
- android:layout_alignParentTop="true"
- app:icon="@drawable/ic_display" />
+ android:orientation="horizontal">
+ <Button
+ android:id="@+id/settings_button"
+ style="?attr/materialIconButtonStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:icon="@drawable/ic_settings" />
+ <Button
+ android:id="@+id/display_button"
+ style="?attr/materialIconButtonStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="gone"
+ app:icon="@drawable/ic_display" />
+ </LinearLayout>
<androidx.viewpager2.widget.ViewPager2
@@ -84,7 +88,7 @@
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_above="@+id/modifier_keys_container"
- android:layout_below="@id/settings_button"/>
+ android:layout_below="@id/menu_container"/>
<LinearLayout
android:id="@+id/modifier_keys_container"
diff --git a/android/TerminalApp/res/menu/main_menu.xml b/android/TerminalApp/res/menu/main_menu.xml
deleted file mode 100644
index dbb788c..0000000
--- a/android/TerminalApp/res/menu/main_menu.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2024 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
- <item android:id="@+id/menu_item_settings"
- android:icon="@drawable/ic_settings"
- android:title="@string/action_settings"
- app:showAsAction="always"/>
- <item android:id="@+id/menu_item_display"
- android:icon="@drawable/ic_display"
- android:enabled="false"
- android:title="@string/action_display"
- app:showAsAction="always"/>
-</menu>