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/layout/settings_disk_resize.xml b/android/TerminalApp/res/layout/settings_disk_resize.xml
index 55fb7af..0052e04 100644
--- a/android/TerminalApp/res/layout/settings_disk_resize.xml
+++ b/android/TerminalApp/res/layout/settings_disk_resize.xml
@@ -36,25 +36,30 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+ <!-- Hardcode LTR to have some gap between assigned size and max size
+ and also match texts with slider -->
<TextView
android:id="@+id/settings_disk_resize_resize_gb_assigned"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:textSize="14sp"
android:singleLine="false"
+ android:gravity="left"
app:layout_constraintWidth_percent="0.5"
- app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@+id/settings_disk_resize_disk_size_slider"/>
+ <!-- Hardcode LTR to have some gap between assigned size and max size
+ and also match texts with slider -->
<TextView
android:id="@+id/settings_disk_resize_resize_gb_max"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:textSize="14sp"
android:singleLine="false"
- android:gravity="end"
+ android:gravity="right"
app:layout_constraintWidth_percent="0.5"
- app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toTopOf="@+id/settings_disk_resize_disk_size_slider"/>
<SeekBar
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>
diff --git a/android/TerminalApp/res/values/strings.xml b/android/TerminalApp/res/values/strings.xml
index fc8d036..a6d461e 100644
--- a/android/TerminalApp/res/values/strings.xml
+++ b/android/TerminalApp/res/values/strings.xml
@@ -32,7 +32,7 @@
<!-- Installer activity title [CHAR LIMIT=none] -->
<string name="installer_title_text">Install Linux terminal</string>
<!-- Installer activity description format [CHAR LIMIT=none] -->
- <string name="installer_desc_text_format">To launch Linux terminal, you need to download roughly <xliff:g id="expected_size" example="350GB">%1$s</xliff:g> of data over the network.\nWould you like to proceed?</string>
+ <string name="installer_desc_text_format">To launch Linux terminal, you need to download roughly <xliff:g id="expected_size" example="350GB">\u200E%1$s\u200E</xliff:g> of data over the network.\nWould you like to proceed?</string>
<!-- Checkbox at the installer activity to download when Wi-Fi is available to prevent from paying network traffic [CHAR LIMIT=none] -->
<string name="installer_wait_for_wifi_checkbox_text">Download using Wi-Fi only</string>
<!-- Button at the installer activity to confirm installation [CHAR LIMIT=16] -->
@@ -72,9 +72,9 @@
<!-- Toast message after new disk size is set. [CHAR LIMIT=none] -->
<string name="settings_disk_resize_resize_message">Disk size set</string>
<!-- Settings menu option description format of the current disk size. [CHAR LIMIT=none] -->
- <string name="settings_disk_resize_resize_gb_assigned_format"><xliff:g id="assigned_size" example="10GB">%1$s</xliff:g> assigned</string>
+ <string name="settings_disk_resize_resize_gb_assigned_format"><xliff:g id="assigned_size" example="10GB">\u200E%1$s\u200E</xliff:g> assigned</string>
<!-- Settings menu option description format of the maximum resizable disk size. [CHAR LIMIT=none] -->
- <string name="settings_disk_resize_resize_gb_max_format"><xliff:g id="max_size" example="256GB">%1$s</xliff:g> max</string>
+ <string name="settings_disk_resize_resize_gb_max_format"><xliff:g id="max_size" example="256GB">\u200E%1$s\u200E</xliff:g> max</string>
<!-- Settings menu button to cancel disk resize. [CHAR LIMIT=16] -->
<string name="settings_disk_resize_resize_cancel">Cancel</string>
<!-- Settings menu button to apply change Terminal app. This will launch a confirmation dialog [CHAR LIMIT=16] -->
diff --git a/android/TerminalApp/res/xml/main_split_config.xml b/android/TerminalApp/res/xml/main_split_config.xml
index 437e75a..bd0271b 100644
--- a/android/TerminalApp/res/xml/main_split_config.xml
+++ b/android/TerminalApp/res/xml/main_split_config.xml
@@ -17,10 +17,6 @@
<resources xmlns:window="http://schemas.android.com/apk/res-auto">
<!-- Define a split for the named activities. -->
- <ActivityRule window:alwaysExpand="true">
- <ActivityFilter window:activityName=".MainActivity" />
- </ActivityRule>
-
<SplitPairRule
window:clearTop="true"
window:finishPrimaryWithSecondary="adjacent"
@@ -42,6 +38,7 @@
<SplitPlaceholderRule
window:placeholderActivityName="com.android.virtualization.terminal.SettingsDiskResizeActivity"
+ window:finishPrimaryWithPlaceholder="adjacent"
window:splitLayoutDirection="locale"
window:splitMaxAspectRatioInPortrait="alwaysAllow"
window:splitMinWidthDp="@integer/split_min_width"