Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20797bf7 authored by Nikhil Nayunigari's avatar Nikhil Nayunigari Committed by Android (Google) Code Review
Browse files

Merge changes I5f2238fd,If829946a into main

* changes:
  Add proxy settings to the ethernet dialog
  Add ethernet dialog to edit IP Settings
parents 6c9ab1c4 9a5ceb8a
Loading
Loading
Loading
Loading
+341 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2025 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.
-->

<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fadeScrollbars="false"
        android:scrollIndicators="top|bottom">

    <LinearLayout
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:theme="@style/Theme.Network"
        android:id="@+id/l_ethernetdialog"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingBottom="8dip">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="16dp">

            <TextView
                android:id="@+id/ethernet_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                style="@style/ethernet_item_label"
                android:text="Port name"
                android:textSize="16sp"
                android:textColor="@android:color/holo_blue_dark"
                android:layout_marginBottom="8dp" />

            <EditText
                android:id="@+id/ethernet_name_edit_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                style="@style/ethernet_item_edit_content"
                android:background="@null"
                android:hint="Ethernet"
                android:inputType="text"
                android:paddingBottom="8dp"
                android:textColor="@android:color/black"
                android:textSize="16sp"
                android:maxLines="1"
                android:minLines="1"/>

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@android:color/darker_gray" />

        </LinearLayout>

        <LinearLayout android:id="@+id/wifi_advanced_toggle"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      style="@style/wifi_item"
                      android:paddingTop="2dp"
                      android:paddingBottom="4dp"
                      android:importantForAccessibility="no"
                      android:visibility="visible">
            <CheckBox android:id="@+id/wifi_advanced_togglebox"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      style="@style/wifi_advanced_toggle"
                      android:importantForAccessibility="yes"
                      android:contentDescription="@string/wifi_advanced_toggle_description"
                      android:text="@string/wifi_show_advanced"/>
        </LinearLayout>

        <LinearLayout android:id="@+id/ethernet_advanced_fields"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="vertical"
                      android:visibility="gone">

            <LinearLayout android:id="@+id/proxy_settings_fields"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          style="@style/wifi_item"
                          android:visibility="visible">

                <TextView android:id="@+id/proxy_settings_title"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          style="@style/wifi_item_label"
                          android:text="@string/proxy_settings_title"/>

                <Spinner android:id="@+id/proxy_settings"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         style="@style/wifi_item_spinner"
                         android:prompt="@string/proxy_settings_title"
                         android:entries="@array/wifi_proxy_settings"/>

            </LinearLayout>

            <LinearLayout android:id="@+id/proxy_warning_limited_support"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          style="@style/wifi_item"
                          android:visibility="gone">
                <!--  Placeholder to enable right-justification of warning -->
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    style="@style/wifi_item_label"/>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/wifi_item_content"
                    android:text="@string/proxy_warning_limited_support"/>
            </LinearLayout>

            <LinearLayout android:id="@+id/proxy_pac_field"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          style="@style/wifi_section"
                          android:visibility="gone">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/wifi_item">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        style="@style/wifi_item_label"
                        android:text="@string/proxy_url_title"/>

                    <EditText android:id="@+id/proxy_pac"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              style="@style/wifi_item_edit_content"
                              android:hint="@string/proxy_url_hint"
                              android:inputType="textNoSuggestions"
                              android:singleLine="true"/>
                </LinearLayout>
            </LinearLayout>
            <LinearLayout android:id="@+id/proxy_fields"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          style="@style/wifi_section"
                          android:visibility="gone">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/wifi_item">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        style="@style/wifi_item_label"
                        android:text="@string/proxy_hostname_label"/>

                    <EditText android:id="@+id/proxy_hostname"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              style="@style/wifi_item_edit_content"
                              android:hint="@string/proxy_hostname_hint"
                              android:inputType="textNoSuggestions"
                              android:singleLine="true"/>
                </LinearLayout>
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/wifi_item">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        style="@style/wifi_item_label"
                        android:text="@string/proxy_port_label"/>

                    <EditText android:id="@+id/proxy_port"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              style="@style/wifi_item_edit_content"
                              android:hint="@string/proxy_port_hint"
                              android:inputType="number"
                              android:singleLine="true"/>
                </LinearLayout>
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/wifi_item">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        style="@style/wifi_item_label"
                        android:text="@string/proxy_exclusionlist_label"/>

                    <EditText android:id="@+id/proxy_exclusionlist"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              style="@style/wifi_item_edit_content"
                              android:hint="@string/proxy_exclusionlist_hint"
                              android:inputType="textNoSuggestions"
                              android:singleLine="true"/>
                </LinearLayout>
            </LinearLayout>

            <LinearLayout android:id="@+id/ip_fields"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          style="@style/ethernet_item"
                          android:visibility="visible">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    style="@style/ethernet_item_label"
                    android:text="@string/ethernet_ip_settings"/>

                <Spinner android:id="@+id/ip_settings"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         style="@style/ethernet_item_spinner"
                         android:prompt="@string/ethernet_ip_settings"
                         android:entries="@array/ethernet_ip_settings"/>

            </LinearLayout>

            <LinearLayout android:id="@+id/staticip"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          style="@style/ethernet_section"
                          android:visibility="gone">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/ethernet_item">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        style="@style/ethernet_item_label"
                        android:text="@string/ethernet_ip_address"/>

                    <EditText android:id="@+id/ipaddress"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              style="@style/ethernet_item_edit_content"
                              android:singleLine="true"
                              android:hint="@string/ethernet_ip_address_hint"
                              android:inputType="textNoSuggestions"/>
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/ethernet_item">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        style="@style/ethernet_item_label"
                        android:text="@string/ethernet_gateway"/>

                    <EditText android:id="@+id/gateway"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              style="@style/ethernet_item_edit_content"
                              android:singleLine="true"
                              android:hint="@string/ethernet_gateway_hint"
                              android:inputType="textNoSuggestions"/>
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/ethernet_item">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        style="@style/ethernet_item_label"
                        android:text="@string/ethernet_network_prefix_length"/>

                    <EditText android:id="@+id/network_prefix_length"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              style="@style/ethernet_item_edit_content"
                              android:singleLine="true"
                              android:hint="@string/ethernet_network_prefix_length_hint"
                              android:inputType="number"/>
                </LinearLayout>
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/ethernet_item">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        style="@style/ethernet_item_label"
                        android:text="@string/ethernet_dns1"/>

                    <EditText android:id="@+id/dns1"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              style="@style/ethernet_item_edit_content"
                              android:singleLine="true"
                              android:hint="@string/ethernet_dns1_hint"
                              android:inputType="textNoSuggestions"/>
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/ethernet_item">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        style="@style/ethernet_item_label"
                        android:text="@string/ethernet_dns2"/>

                    <EditText android:id="@+id/dns2"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              style="@style/ethernet_item_edit_content"
                              android:singleLine="true"
                              android:hint="@string/ethernet_dns2_hint"
                              android:inputType="textNoSuggestions"/>
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

</androidx.core.widget.NestedScrollView>
 No newline at end of file
+9 −0
Original line number Diff line number Diff line
@@ -676,6 +676,15 @@
        <item>Long</item>
    </string-array>

    <!-- Ethernet IP settings. -->
    <!-- Note that adding/removing/moving the items will need ethernet settings code change. -->
    <string-array name="ethernet_ip_settings">
        <!-- Use DHCP (Dynamic Host Configuration Protocol) for obtaining IP settings [CHAR LIMIT=25] -->
        <item>DHCP</item>
        <!-- Use statically defined IP settings [CHAR LIMIT=25]-->
        <item>Static</item>
    </string-array>

    <!-- Values for the list of long press timeout options. -->
    <string-array name="long_press_timeout_selector_values" translatable="false">
        <item>400</item>
+29 −0
Original line number Diff line number Diff line
@@ -2695,6 +2695,32 @@
    <string name="hotspot_connection_category">Hotspot connection</string>
    <!-- Connection strength preference in Hotspot connection preference category [CHAR LIMIT=NONE]-->
    <string name="hotspot_connection_strength">Connection strength</string>
    <!-- Hint text for the IP address -->
    <string name="ethernet_ip_address_hint" translatable="false">192.168.1.128</string>
    <!-- Hint text for DNS -->
    <string name="ethernet_dns1_hint" translatable="false">8.8.8.8</string>
    <!-- Hint text for DNS -->
    <string name="ethernet_dns2_hint" translatable="false">8.8.4.4</string>
    <!-- Hint text for the gateway -->
    <string name="ethernet_gateway_hint" translatable="false">192.168.1.1</string>
    <!-- Hint text for network prefix length -->
    <string name="ethernet_network_prefix_length_hint" translatable="false">24</string>
    <!-- Label for the DNS (first one) -->
    <string name="ethernet_dns1">DNS 1 (unless overridden by private DNS)</string>
    <!-- Label for the DNS (second one)-->
    <string name="ethernet_dns2">DNS 2 (unless overridden by private DNS)</string>
    <!-- Label for the gateway of the network -->
    <string name="ethernet_gateway">Gateway</string>
    <!-- Label for the network prefix of the network [CHAR LIMIT=25]-->
    <string name="ethernet_network_prefix_length">Network prefix length</string>
    <!-- Label for the spinner to show ip settings [CHAR LIMIT=25] -->
    <string name="ethernet_ip_settings">IP settings</string>
    <!-- Label for the ethernet config dialog submit button [CHAR LIMIT=25] -->
    <string name="ethernet_config_submit">Submit</string>
    <!-- Label for the ethernet config dialog cancel button [CHAR LIMIT=25] -->
    <string name="ethernet_config_cancel">Cancel</string>
    <!-- Label for the ethernet config dialog title [CHAR LIMIT=25] -->
    <string name="ethernet_config_title">Ethernet Settings</string>
    <!-- Wifi saved access points.  Used as a label under the shortcut icon that goes to Wifi saved access points. [CHAR LIMIT=20] -->
    <string name="wifi_saved_access_points_label">Saved networks</string>
@@ -3961,6 +3987,9 @@
    <!-- Label for ethernet tether checkbox [CHAR LIMIT=NONE]-->
    <string name="ethernet_tether_checkbox_text">Ethernet tethering</string>
    <!-- Button label to modify a Ethernet network -->
    <string name="ethernet_modify">Modify</string>
    <!-- Tethering footer info [CHAR LIMIT=NONE]-->
    <string name="tethering_footer_info">Use hotspot and tethering to provide internet to other devices through your data connection. Apps can also create a hotspot to share content with nearby devices.</string>
    <!-- Tethering footer info for the device which supports Wi-Fi and Wi-Fi tethering enabled at the same time [CHAR LIMIT=NONE]-->
+51 −0
Original line number Diff line number Diff line
@@ -147,6 +147,57 @@
        <item name="android:orientation">vertical</item>
    </style>

    <style name="ethernet_item">
        <item name="android:layout_marginTop">8dip</item>
        <item name="android:layout_marginStart">8dip</item>
        <item name="android:layout_marginEnd">8dip</item>
        <item name="android:paddingStart">8dip</item>
        <item name="android:paddingEnd">8dip</item>
        <item name="android:orientation">vertical</item>
        <item name="android:gravity">start</item>
    </style>

    <style name="ethernet_item_label">
        <item name="android:paddingStart">8dip</item>
        <item name="android:textSize">14sp</item>
        <item name="android:textAlignment">viewStart</item>
        <item name="android:textAppearance">@*android:style/TextAppearance.DeviceDefault.Body1</item>
        <item name="android:textColor">?android:attr/textColorSecondary</item>
    </style>

    <style name="ethernet_item_content">
        <item name="android:textAlignment">viewStart</item>
        <item name="android:textAppearance">@*android:style/TextAppearance.DeviceDefault.Subhead</item>
        <item name="android:textColor">?android:attr/textColorPrimary</item>
        <item name="android:minHeight">@dimen/min_tap_target_size</item>
    </style>

    <style name="ethernet_item_spinner" parent="ethernet_item_content">
        <item name="android:minHeight">48dp</item>
    </style>

    <style name="ethernet_advanced_toggle" parent="ethernet_item_content">
        <item name="android:background">@null</item>
        <item name="android:button">@null</item>
        <item name="android:drawableEnd">@drawable/ic_expand</item>
        <item name="android:paddingStart">8dip</item>
        <item name="android:textSize">14sp</item>
    </style>

    <style name="ethernet_item_edit_content">
        <item name="android:paddingStart">4dip</item>
        <item name="android:layout_marginStart">4dip</item>
        <item name="android:textAlignment">viewStart</item>
        <item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault.Medium</item>
        <item name="android:textColorHint">?android:attr/textColorSecondary</item>
        <item name="android:minHeight">@dimen/min_tap_target_size</item>
        <item name="android:maxLength">500</item>
    </style>

    <style name="ethernet_section">
        <item name="android:orientation">vertical</item>
    </style>

    <style name="adb_wireless_item">
        <item name="android:layout_marginTop">8dp</item>
        <item name="android:layout_marginStart">8dp</item>
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
    xmlns:settings="http://schemas.android.com/apk/res-auto">

    <com.android.settingslib.widget.LayoutPreference
        android:key="connection_header"
        android:key="ethernet_details"
        android:layout="@layout/settings_entity_header"
        android:selectable="false"
        android:order="-10000"/>
Loading