Skip to content

Commit

Permalink
tunnel: ssh redesign (fixes #1389) (#1390)
Browse files Browse the repository at this point in the history
  • Loading branch information
ali18997 authored Aug 20, 2020
1 parent ba9688a commit cf1ac4b
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class TunnelSSHFragment : BaseFragment(), View.OnClickListener {
hostsPosition = ArrayList()
val window = dialog.window
val windowHost = dialogHosts.window
window!!.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
windowHost!!.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
window!!.setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
windowHost!!.setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
windowHost.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
try{ initializeDialog2()} catch (exception:Exception){Log.e("Error1", exception.toString())}
Expand Down Expand Up @@ -192,16 +192,20 @@ class TunnelSSHFragment : BaseFragment(), View.OnClickListener {
}

override fun onClick(v: View?) {

fun showDialog(dialog:Dialog){
dialog.window!!.setBackgroundDrawableResource(android.R.color.transparent)
dialog.show()
}
when (v?.id) {
R.id.btn_adding_host -> { addingHostButton() }
R.id.btn_adding_port -> { addingPortButton() }
R.id.notify_now -> {
bind!!.notifyNow.isEnabled = false
listener.sendMessage(getString(R.string.TREEHOUSES_SSHTUNNEL_NOTICE_NOW))
}
R.id.btn_add_port -> dialog.show()
R.id.btn_add_hosts -> dialogHosts.show()

R.id.btn_add_port -> showDialog(dialog)
R.id.btn_add_hosts -> showDialog(dialogHosts)
}
}

Expand Down
69 changes: 37 additions & 32 deletions app/src/main/res/layout/activity_tunnel_ssh_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,63 +18,68 @@

<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/notify_now"
android:layout_width="0dp"
android:layout_weight="1"
android:background="@drawable/gitter_button"
android:textColor="@color/bg_white"
android:text="Gitter Notify"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:layout_height="35dp"
android:layout_marginTop="10dp"
android:layout_marginStart="25dp"
android:layout_marginLeft="25dp"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"/>

<Switch
android:id="@+id/switchNotification"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="@dimen/margin_medium"

android:layout_marginTop="10dp"
android:layout_marginStart="0dp"
android:layout_marginEnd="25dp"
android:layout_marginRight="8dp"
android:layout_marginLeft="0dp"
android:text="Notification: "
android:textColor="@color/daynight_textColor"
android:textSize="@dimen/text_size_large" />

<Button
android:id="@+id/notify_now"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"

android:layout_marginEnd="20dp"
android:layout_marginRight="8dp"
android:text="Notify Now" />

</LinearLayout>
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content">

<Button
android:id="@+id/btn_add_hosts"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginTop="30dp"
android:layout_marginStart="30dp"
android:layout_marginStart="25dp"
android:layout_marginLeft="30dp"
android:layout_marginEnd="30dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="30dp"

android:layout_marginTop="20dp"
android:background="@drawable/ic_green"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:background="@drawable/add_command_background"
android:text="Add hosts"
android:layout_weight="1"
android:textColor="@color/black_overlay" />
android:text="Add Hosts"
android:textColor="@color/bg_white"
android:layout_weight="1" />

<Button
android:id="@+id/btn_add_port"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginTop="30dp"
android:layout_marginStart="30dp"
android:layout_marginStart="25dp"
android:layout_marginEnd="25dp"
android:layout_marginLeft="30dp"
android:layout_marginEnd="30dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="30dp"

android:layout_marginTop="20dp"
android:textColor="@color/bg_white"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:background="@drawable/add_command_background"
android:text="Add port"
android:layout_weight="1"
android:textColor="@color/black_overlay" />
android:background="@drawable/ic_green"
android:text="Add Port"
android:layout_weight="1"/>
</LinearLayout>

<ListView
Expand Down
12 changes: 7 additions & 5 deletions app/src/main/res/layout/dialog_sshtunnel_hosts.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_width="350dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/margin_medium"
android:theme="@style/CardTheme"
android:background="@color/card_background">
android:background="@drawable/alertdialog_background">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/daynight_textColor"
android:textSize="24sp"
app:fontFamily="@font/roboto_bold"
android:textStyle="bold"
Expand Down Expand Up @@ -39,6 +39,7 @@
android:layout_weight="1"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:textColorHint="@color/expandable_child_text"
android:textColor="@color/daynight_textColor"
android:hint="Host Name"
/>
Expand All @@ -49,6 +50,7 @@
android:id="@+id/ExternalTextInput2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="@color/expandable_child_text"
>

<com.google.android.material.textfield.TextInputEditText
Expand All @@ -69,7 +71,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_small"
android:text="Add host"
android:textColor="#000000"
android:background="@color/md_grey_300"/>
android:background="@drawable/ic_green"
android:textColor="#FFFFFF"/>

</LinearLayout>
12 changes: 7 additions & 5 deletions app/src/main/res/layout/dialog_sshtunnel_ports.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_width="350dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/margin_medium"
android:theme="@style/CardTheme"
android:background="@color/card_background">
android:background="@drawable/alertdialog_background">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="24sp"
android:textColor="@color/daynight_textColor"
app:fontFamily="@font/roboto_bold"
android:textStyle="bold"
android:text="Adding Port">
Expand Down Expand Up @@ -43,6 +43,7 @@
android:layout_weight="1"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:textColorHint="@color/expandable_child_text"
android:textColor="@color/daynight_textColor"
android:hint="External"
android:inputType="number"/>
Expand All @@ -53,6 +54,7 @@
android:id="@+id/ExternalTextInput2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="@color/expandable_child_text"
>

<com.google.android.material.textfield.TextInputEditText
Expand All @@ -73,7 +75,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_small"
android:text="Add Port"
android:textColor="#000000"
android:background="@color/md_grey_300"/>
android:background="@drawable/ic_green"
android:textColor="#FFFFFF"/>

</LinearLayout>

0 comments on commit cf1ac4b

Please sign in to comment.