Advertisement
Guest User

Untitled

a guest
Oct 6th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 13.54 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <layout xmlns:android="http://schemas.android.com/apk/res/android"
  3.    xmlns:app="http://schemas.android.com/apk/res-auto"
  4.    xmlns:tools="http://schemas.android.com/tools">
  5.  
  6.     <data>
  7.  
  8.         <import type="com.wireguard.android.util.ExtensionsKt" />
  9.  
  10.         <import type="com.wireguard.android.widget.KeyInputFilter" />
  11.  
  12.         <import type="com.wireguard.android.widget.NameInputFilter" />
  13.  
  14.         <import type="com.wireguard.config.Peer" />
  15.  
  16.         <variable
  17.            name="fragment"
  18.            type="com.wireguard.android.fragment.TunnelEditorFragment" />
  19.  
  20.         <variable
  21.            name="config"
  22.            type="com.wireguard.config.Config.Observable" />
  23.     </data>
  24.  
  25.     <androidx.coordinatorlayout.widget.CoordinatorLayout
  26.        android:id="@+id/main_container"
  27.        android:layout_width="match_parent"
  28.        android:layout_height="match_parent"
  29.        android:background="?android:attr/colorBackground">
  30.  
  31.         <ScrollView
  32.            android:layout_width="match_parent"
  33.            android:layout_height="match_parent">
  34.  
  35.             <LinearLayout
  36.                android:layout_width="match_parent"
  37.                android:layout_height="wrap_content"
  38.                android:orientation="vertical">
  39.  
  40.                 <androidx.cardview.widget.CardView
  41.                    android:layout_width="match_parent"
  42.                    android:layout_height="wrap_content"
  43.                    android:layout_marginStart="8dp"
  44.                    android:layout_marginTop="8dp"
  45.                    android:layout_marginEnd="8dp"
  46.                    android:layout_marginBottom="4dp"
  47.                    android:background="?android:attr/colorBackground"
  48.                    app:cardCornerRadius="4dp"
  49.                    app:cardElevation="2dp"
  50.                    app:contentPadding="8dp">
  51.  
  52.                     <RelativeLayout
  53.                        android:layout_width="match_parent"
  54.                        android:layout_height="wrap_content">
  55.  
  56.                         <TextView
  57.                            android:id="@+id/interface_title"
  58.                            style="@style/TextAppearance.MaterialComponents.Headline6"
  59.                            android:layout_width="match_parent"
  60.                            android:layout_height="wrap_content"
  61.                            android:layout_alignParentTop="true"
  62.                            android:text="@string/interface_title" />
  63.  
  64.                         <com.google.android.material.textfield.TextInputLayout
  65.                            android:id="@+id/interface_name_layout"
  66.                            style="@style/Widget.MaterialComponents.TextInputEditText.OutlinedBox.Dense"
  67.                            android:layout_width="match_parent"
  68.                            android:layout_height="wrap_content"
  69.                            android:layout_below="@+id/interface_title"
  70.                            android:layout_alignParentStart="true"
  71.                            android:layout_marginTop="8dp">
  72.  
  73.                             <com.google.android.material.textfield.TextInputEditText
  74.                                android:id="@+id/interface_name_text"
  75.                                android:layout_width="match_parent"
  76.                                android:layout_height="wrap_content"
  77.                                android:hint="@string/name"
  78.                                android:inputType="textNoSuggestions|textVisiblePassword"
  79.                                android:text="@={config.name}"
  80.                                app:filter="@{NameInputFilter.newInstance()}" />
  81.                         </com.google.android.material.textfield.TextInputLayout>
  82.  
  83.                         <com.google.android.material.textfield.TextInputLayout
  84.                            android:id="@+id/private_key_text_layout"
  85.                            style="@style/Widget.MaterialComponents.TextInputEditText.OutlinedBox.Dense"
  86.                            android:layout_width="match_parent"
  87.                            android:layout_height="wrap_content"
  88.                            android:layout_below="@+id/interface_name_layout"
  89.                            android:layout_alignParentStart="true">
  90.  
  91.                             <com.google.android.material.textfield.TextInputEditText
  92.                                android:id="@+id/private_key_text"
  93.                                android:layout_width="match_parent"
  94.                                android:layout_height="wrap_content"
  95.                                android:layout_alignParentStart="true"
  96.                                android:contentDescription="@string/public_key_description"
  97.                                android:hint="@string/private_key"
  98.                                android:inputType="textNoSuggestions|textVisiblePassword"
  99.                                android:text="@={config.interfaceSection.privateKey}"
  100.                                app:filter="@{KeyInputFilter.newInstance()}" />
  101.                         </com.google.android.material.textfield.TextInputLayout>
  102.  
  103.                         <com.google.android.material.textfield.TextInputLayout
  104.                            android:id="@+id/public_key_label_layout"
  105.                            style="@style/Widget.MaterialComponents.TextInputEditText.OutlinedBox.Dense"
  106.                            android:layout_width="match_parent"
  107.                            android:layout_height="wrap_content"
  108.                            android:layout_below="@+id/private_key_text_layout"
  109.                            android:layout_alignParentStart="true">
  110.  
  111.                             <com.google.android.material.textfield.TextInputEditText
  112.                                android:id="@+id/public_key_text"
  113.                                android:layout_width="match_parent"
  114.                                android:layout_height="wrap_content"
  115.                                android:ellipsize="end"
  116.                                android:focusable="false"
  117.                                android:hint="@string/hint_generated"
  118.                                android:maxLines="1"
  119.                                android:onClick="@{ExtensionsKt::copyTextView}"
  120.                                android:text="@{config.interfaceSection.publicKey}" />
  121.                         </com.google.android.material.textfield.TextInputLayout>
  122.  
  123.                         <com.google.android.material.textfield.TextInputLayout
  124.                            android:id="@+id/addresses_label_layout"
  125.                            style="@style/Widget.MaterialComponents.TextInputEditText.OutlinedBox.Dense"
  126.                            android:layout_width="match_parent"
  127.                            android:layout_height="wrap_content"
  128.                            android:layout_below="@+id/public_key_label_layout"
  129.                            android:layout_alignParentStart="true"
  130.                            android:layout_toStartOf="@+id/listen_port_label_layout">
  131.  
  132.                             <com.google.android.material.textfield.TextInputEditText
  133.                                android:id="@+id/addresses_label_text"
  134.                                android:layout_width="match_parent"
  135.                                android:layout_height="wrap_content"
  136.                                android:layout_alignParentStart="true"
  137.                                android:hint="@string/addresses"
  138.                                android:inputType="textNoSuggestions|textVisiblePassword"
  139.                                android:text="@={config.interfaceSection.addresses}" />
  140.                         </com.google.android.material.textfield.TextInputLayout>
  141.  
  142.                         <com.google.android.material.textfield.TextInputLayout
  143.                            android:id="@+id/listen_port_layout"
  144.                            style="@style/Widget.MaterialComponents.TextInputEditText.OutlinedBox.Dense"
  145.                            android:layout_width="96dp"
  146.                            android:layout_height="wrap_content"
  147.                            android:layout_alignBaseline="@+id/addresses_label_layout"
  148.                            android:layout_alignParentEnd="true">
  149.  
  150.                             <com.google.android.material.textfield.TextInputEditText
  151.                                android:layout_width="match_parent"
  152.                                android:layout_height="wrap_content"
  153.                                android:hint="@string/listen_port"
  154.                                android:inputType="number"
  155.                                android:text="@={config.interfaceSection.listenPort}"
  156.                                android:textAlignment="center" />
  157.                         </com.google.android.material.textfield.TextInputLayout>
  158.  
  159.                         <com.google.android.material.textfield.TextInputLayout
  160.                            android:id="@+id/dns_servers_label_layout"
  161.                            style="@style/Widget.MaterialComponents.TextInputEditText.OutlinedBox.Dense"
  162.                            android:layout_width="match_parent"
  163.                            android:layout_height="wrap_content"
  164.                            android:layout_below="@+id/listen_port_layout"
  165.                            android:layout_alignParentStart="true"
  166.                            android:layout_toStartOf="@+id/mtu_label_layout">
  167.  
  168.                             <com.google.android.material.textfield.TextInputEditText
  169.                                android:id="@+id/dns_servers_text"
  170.                                android:layout_width="match_parent"
  171.                                android:layout_height="wrap_content"
  172.                                android:hint="@string/dns_servers"
  173.                                android:inputType="textNoSuggestions|textVisiblePassword"
  174.                                android:text="@={config.interfaceSection.dnses}" />
  175.                         </com.google.android.material.textfield.TextInputLayout>
  176.  
  177.                         <com.google.android.material.textfield.TextInputLayout
  178.                            android:id="@+id/mtu_label_layout"
  179.                            style="@style/Widget.MaterialComponents.TextInputEditText.OutlinedBox.Dense"
  180.                            android:layout_width="96dp"
  181.                            android:layout_height="wrap_content"
  182.                            android:layout_alignBaseline="@id/dns_servers_label_layout"
  183.                            android:layout_alignParentEnd="true">
  184.  
  185.                             <com.google.android.material.textfield.TextInputEditText
  186.                                android:id="@+id/mtu_text"
  187.                                android:layout_width="match_parent"
  188.                                android:layout_height="wrap_content"
  189.                                android:hint="@string/mtu"
  190.                                android:inputType="number"
  191.                                android:text="@={config.interfaceSection.mtu}"
  192.                                android:textAlignment="center" />
  193.                         </com.google.android.material.textfield.TextInputLayout>
  194.  
  195.                         <Button
  196.                            android:id="@+id/set_excluded_applications"
  197.                            style="@style/Widget.MaterialComponents.Button.TextButton"
  198.                            android:layout_width="match_parent"
  199.                            android:layout_height="wrap_content"
  200.                            android:layout_below="@+id/dns_servers_label_layout"
  201.                            android:layout_margin="8dp"
  202.                            android:onClick="@{fragment::onRequestSetExcludedApplications}"
  203.                            android:text="@{@plurals/set_excluded_applications(config.interfaceSection.excludedApplicationsCount, config.interfaceSection.excludedApplicationsCount)}" />
  204.  
  205.                         <Button
  206.                            android:id="@+id/generate_private_key_button"
  207.                            style="@style/Widget.MaterialComponents.Button.TextButton"
  208.                            android:layout_width="match_parent"
  209.                            android:layout_height="wrap_content"
  210.                            android:layout_below="@+id/dns_servers_label_layout"
  211.                            android:layout_alignParentEnd="true"
  212.                            android:layout_margin="8dp"
  213.                            android:onClick="@{() -> config.interfaceSection.generateKeypair()}"
  214.                             android:text="@string/generate" />
  215.  
  216.                     </RelativeLayout>
  217.                 </androidx.cardview.widget.CardView>
  218.  
  219.                 <LinearLayout
  220.                    android:layout_width="match_parent"
  221.                    android:layout_height="wrap_content"
  222.                    android:divider="@null"
  223.                    android:orientation="vertical"
  224.                    app:items="@{config.peers}"
  225.                    app:layout="@{@layout/tunnel_editor_peer}"
  226.                    tools:ignore="UselessLeaf" />
  227.  
  228.                 <Button
  229.                    style="@style/Widget.MaterialComponents.Button.TextButton"
  230.                    android:layout_width="match_parent"
  231.                    android:layout_height="wrap_content"
  232.                    android:layout_margin="8dp"
  233.                    android:onClick="@{() -> config.peers.add(Peer.Observable.newInstance())}"
  234.                     android:text="@string/add_peer" />
  235.             </LinearLayout>
  236.         </ScrollView>
  237.     </androidx.coordinatorlayout.widget.CoordinatorLayout>
  238. </layout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement