Skip to content

Commit

Permalink
system: tethering redesign (fixes #1485) (#1484)
Browse files Browse the repository at this point in the history
Co-authored-by: Derek Yeh <[email protected]>
  • Loading branch information
ali18997 and dyeh123 authored Aug 30, 2020
1 parent 7634ee0 commit d4477e8
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class ViewHolderTether internal constructor(v: View, listener: HomeInteractListe
}

init {
val imageViewSettings = v.findViewById<ImageView>(R.id.imageViewSettings)
val btnStartConfig = v.findViewById<Button>(R.id.btn_start_config)
val imageViewSettings = v.findViewById<Button>(R.id.btn_configure)
val btnStartConfig = v.findViewById<Button>(R.id.btn_hotspot_start)
editTextSSID = v.findViewById(R.id.editTextSSID)
editTextPassword = v.findViewById(R.id.editTextPassword)
editTextPassword.inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class NetworkListItem(var title: String, var layout: Int) {
val systemList: MutableList<NetworkListItem> = ArrayList()
systemList.add(NetworkListItem("Shutdown & Reboot", R.layout.configure_shutdown_reboot))
systemList.add(NetworkListItem("Open VNC", R.layout.open_vnc))
systemList.add(NetworkListItem("Configure Tethering (beta)", R.layout.configure_tethering))
systemList.add(NetworkListItem("Share Internet With Pi (beta)", R.layout.configure_tethering))
systemList.add(NetworkListItem("Add SSH Key", R.layout.configure_ssh_key))
systemList.add(NetworkListItem("Toggle Camera", R.layout.configure_camera))
systemList.add(NetworkListItem("Wifi Country", R.layout.configure_wificountry))
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/drawable/ic_green2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<solid android:color="#4CAF50"/>

<corners android:radius="10dp" />

</shape>
93 changes: 69 additions & 24 deletions app/src/main/res/layout/configure_tethering.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,72 @@
android:orientation="vertical"
android:theme="@style/AppTheme">

<TextView
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="@color/daynight_textColor"
android:layout_height="wrap_content"
android:text="Share Internet Using a USB Cable" />

<TextView
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="match_parent"
android:textColor="@color/daynight_textColor"
android:layout_height="wrap_content"
android:text="Connect this device to Pi using a USB Cable. Use the Configure button to enable USB Tethering in Settings to start the connection." />

<Button
android:id="@+id/btn_configure"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="match_parent"
android:layout_weight="1"
android:background="@drawable/ic_grey_dark"
android:textColor="#ffffff"
android:layout_height="wrap_content"
android:text="Configure" />

<TextView
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="match_parent"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="@color/daynight_textColor"
android:layout_height="wrap_content"
android:text="Share Internet Using WiFi" />

<TextView
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="match_parent"
android:textColor="@color/daynight_textColor"
android:layout_height="wrap_content"
android:text="Use the Configure button to enable Mobile Hotspot in Settings and to edit the Hotspot Name and Password. Enter those details below to start the connection." />

<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:padding="@dimen/margin_small">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/editTextSSID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/daynight_textColor"
android:hint="Hotspot SSID" />
android:hint="Hotspot Name" />
</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
Expand All @@ -25,6 +80,8 @@
app:hintAnimationEnabled="false"
app:hintEnabled="false"
android:padding="@dimen/margin_small"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@color/md_blue_600">

Expand All @@ -37,30 +94,18 @@
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>

<LinearLayout
<Button
android:id="@+id/btn_hotspot_start"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<!--Icon made by Egor Rumyantsev from www.flaticon.com-->

<include
layout="@layout/layout_btn_configuration"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
android:layout_weight="1"
android:background="@drawable/ic_green2"
android:textColor="#ffffff"
android:layout_height="wrap_content"
android:text="Connect to Mobile Hotspot" />

<ImageView
android:id="@+id/imageViewSettings"
android:background="#FFFFFF"
android:layout_width="@dimen/icon_size_mid"
android:layout_height="@dimen/icon_size_mid"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:elevation="4dp"
android:padding="@dimen/margin_small"
app:srcCompat="@drawable/settings_icon" />

</LinearLayout>

</LinearLayout>
</LinearLayout>

0 comments on commit d4477e8

Please sign in to comment.