Add VPN settings classes to Settings app.
PATCH SET 2: + Add import com.android.settings.R PATCH SET 3: + Remove @Override interface methods to be compilable by Java 1.5. PATCH SET 4: + Add import android.net.vpn.VpnManager PATCH SET 5: + Add license headers. PATCH SET 6: + Remove Constant.java and move the constants to VpnSettings. + Make AuthenticationActor implement DialogInterface's handlers. + Remove trailing spaces. PATCH SET 7: + Remove default username.
This commit is contained in:
48
res/layout/vpn_connect_dialog_view.xml
Normal file
48
res/layout/vpn_connect_dialog_view.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginLeft="@dimen/vpn_connect_margin_left"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView android:id="@+id/username_str"
|
||||
android:layout_width="@dimen/vpn_connect_input_box_label_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/vpn_connect_normal_text_size"
|
||||
android:gravity="right"
|
||||
android:layout_marginRight="@dimen/vpn_connect_input_box_padding"
|
||||
android:text="@string/vpn_username_colon" />
|
||||
<EditText android:id="@+id/username_value"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/vpn_connect_margin_right"
|
||||
android:singleLine="True"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginLeft="@dimen/vpn_connect_margin_left"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10sp">
|
||||
<TextView android:id="@+id/password_str"
|
||||
android:layout_width="@dimen/vpn_connect_input_box_label_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/vpn_connect_normal_text_size"
|
||||
android:gravity="right"
|
||||
android:layout_marginRight="@dimen/vpn_connect_input_box_padding"
|
||||
android:text="@string/vpn_password_colon" />
|
||||
<EditText android:id="@+id/password_value"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/vpn_connect_margin_right"
|
||||
android:password="True"
|
||||
android:singleLine="True"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
9
res/values/dimens.xml
Executable file
9
res/values/dimens.xml
Executable file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="vpn_connect_margin_left">5sp</dimen>
|
||||
<dimen name="vpn_connect_margin_right">5sp</dimen>
|
||||
<dimen name="vpn_connect_normal_text_size">16sp</dimen>
|
||||
<dimen name="vpn_connect_input_box_label_width">90sp</dimen>
|
||||
<dimen name="vpn_connect_input_box_width">200sp</dimen>
|
||||
<dimen name="vpn_connect_input_box_padding">5sp</dimen>
|
||||
</resources>
|
||||
@@ -1726,4 +1726,73 @@ found in the list of installed applications.</string>
|
||||
|
||||
<!-- Power Control Widget -->
|
||||
<string name="gadget_title">Power Control</string>
|
||||
|
||||
<string name="vpn_settings_activity_title">VPN settings</string>
|
||||
|
||||
<string name="vpn_username_colon">User name:</string>
|
||||
<string name="vpn_password_colon">Password:</string>
|
||||
<string name="vpn_username">User name</string>
|
||||
<string name="vpn_password">Password</string>
|
||||
<string name="vpn_you_miss_a_field">You missed a field!</string>
|
||||
<string name="vpn_please_fill_up">Please fill up \"%s\".</string>
|
||||
|
||||
<string name="vpn_connect_button">Connect</string>
|
||||
<string name="vpn_cancel_button">Cancel</string>
|
||||
<string name="vpn_yes_button">Yes</string>
|
||||
<string name="vpn_no_button">No</string>
|
||||
<string name="vpn_back_button">Back</string>
|
||||
<string name="vpn_mistake_button">No, it's a mistake</string>
|
||||
|
||||
<string name="vpn_menu_save">Save</string>
|
||||
<!-- Edit VPN screen menu option to discard the user's changes for this VPN -->
|
||||
<string name="vpn_menu_cancel">Discard</string>
|
||||
<string name="vpn_menu_connect">Connect</string>
|
||||
<string name="vpn_menu_disconnect">Disconnect</string>
|
||||
<string name="vpn_menu_edit">Edit</string>
|
||||
<string name="vpn_menu_delete">Delete</string>
|
||||
|
||||
<!-- VPN error dialog title -->
|
||||
<string name="vpn_error_title">Attention</string>
|
||||
<string name="vpn_error_name_empty">VPN Name cannot be empty.</string>
|
||||
<string name="vpn_error_server_name_empty">The Server Name field cannot be empty.</string>
|
||||
<string name="vpn_error_duplicate_name">The VPN Name \'%s\' already exists. Find another name.</string>
|
||||
<string name="vpn_error_user_certificate_not_selected">Need to select a user certificate.</string>
|
||||
<string name="vpn_error_ca_certificate_not_selected">Need to select a CA certificate.</string>
|
||||
<string name="vpn_error_userkey_not_selected">Need to select a userkey.</string>
|
||||
<string name="vpn_confirm_profile_cancellation">Are you sure you don\'t want to create this profile?</string>
|
||||
<string name="vpn_confirm_reconnect">The previous connection attempt failed. Do you want to try again?</string>
|
||||
|
||||
<string name="vpn_add_new_vpn">Add new VPN</string>
|
||||
<string name="vpn_edit_title_add">Add new %s VPN</string>
|
||||
<string name="vpn_edit_title_edit">Edit %s VPN</string>
|
||||
<string name="vpn_type_title">Select VPN type</string>
|
||||
<string name="vpns">VPN networks</string>
|
||||
<!-- EditTextPreference summary text when no value has been set -->
|
||||
<string name="vpn_not_set">Click to set the value</string>
|
||||
<!-- EditTextPreference summary text when VPN is connecting -->
|
||||
<string name="vpn_connecting">Connecting...</string>
|
||||
<!-- EditTextPreference summary text when VPN is disconnecting -->
|
||||
<string name="vpn_disconnecting">Disconnecting...</string>
|
||||
<!-- EditTextPreference summary text when VPN is connected -->
|
||||
<string name="vpn_connected">Connected</string>
|
||||
<!-- EditTextPreference summary text when VPN is not connected -->
|
||||
<string name="vpn_connect_hint">Select to connect</string>
|
||||
<!-- dialog title when asking for username and password -->
|
||||
<string name="vpn_connect_to">Connect to</string>
|
||||
|
||||
<string name="vpn_name">VPN Name</string>
|
||||
<string name="vpn_name_summary">Give a name to this VPN;</string>
|
||||
|
||||
<string name="vpn_profile_added">'%s' is added</string>
|
||||
<string name="vpn_profile_replaced">Changes are made to '%s'</string>
|
||||
|
||||
<string name="vpn_user_certificate_title">User Certificate</string>
|
||||
<string name="vpn_ca_certificate_title">CA Certificate</string>
|
||||
<string name="vpn_userkey_title">User Key</string>
|
||||
<string name="vpn_server_name_title">Server Name</string>
|
||||
<string name="vpn_dns_search_list_title">DNS Search List</string>
|
||||
|
||||
<string name="vpn_settings_category">VPN</string>
|
||||
<string name="vpn_settings_title">VPN</string>
|
||||
<string name="vpn_settings_summary">Set up and manage VPN configurations, connections</string>
|
||||
</resources>
|
||||
|
||||
27
res/xml/vpn_edit.xml
Normal file
27
res/xml/vpn_edit.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2008 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
|
||||
|
||||
<EditTextPreference
|
||||
android:title="@string/vpn_name"
|
||||
android:dialogTitle="@string/vpn_name"
|
||||
android:key="vpn_name"
|
||||
android:summary="@string/vpn_name_summary"
|
||||
android:singleLine="true"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
36
res/xml/vpn_settings.xml
Normal file
36
res/xml/vpn_settings.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2008 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/vpn_settings_activity_title">
|
||||
|
||||
<PreferenceScreen android:key="add_new_vpn"
|
||||
android:title="@string/vpn_add_new_vpn">
|
||||
<!--intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings.vpn"
|
||||
android:targetClass="com.android.settings.vpn.VpnEditor" /-->
|
||||
</PreferenceScreen>
|
||||
|
||||
<!--CheckBoxPreference android:key="installer_enabled"
|
||||
android:defaultValue="false"
|
||||
android:title="@string/installer_enabled"
|
||||
android:summaryOn="@string/installer_enabled_summary_on"
|
||||
android:summaryOff="@string/installer_enabled_summary_off" /-->
|
||||
|
||||
<PreferenceCategory android:key="vpn_list" android:title="@string/vpns">
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
21
res/xml/vpn_type.xml
Normal file
21
res/xml/vpn_type.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2008 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
||||
android:title="@string/vpn_type_title">
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -52,6 +52,16 @@
|
||||
android:targetClass="com.android.settings.bluetooth.BluetoothSettings" />
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen
|
||||
android:title="@string/vpn_settings_title"
|
||||
android:summary="@string/vpn_settings_summary"
|
||||
android:dependency="toggle_airplane">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.vpn.VpnSettings" />
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen
|
||||
android:title="@string/network_settings_title"
|
||||
android:summary="@string/network_settings_summary"
|
||||
|
||||
Reference in New Issue
Block a user