1. old core fix, clipboard fix, GUI fix

This commit is contained in:
vadym 2020-06-27 13:10:10 -07:00
parent b04ca172f4
commit 317e040e1b
2 changed files with 26 additions and 24 deletions

View File

@ -72,11 +72,11 @@ class MainActivity : AppCompatActivity() {
val copyAddressButton = findViewById<Button>(R.id.copyIp)
copyAddressButton.setOnClickListener {
val ipLabel = findViewById<TextView>(R.id.ipLabel)
val ip = findViewById<TextView>(R.id.ip)
val clipboard: ClipboardManager =
getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip =
ClipData.newPlainText("IP address", ipLabel.text.toString())
ClipData.newPlainText("IP address", ip.text.toString())
clipboard.setPrimaryClip(clip)
showToast(getString(R.string.address_copied))
}

View File

@ -17,23 +17,34 @@
android:paddingLeft="20dp"
android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent"
android:animateLayoutChanges="true"
android:visibility="gone">
<TextView
android:id="@+id/ipLabel"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@android:color/transparent"
android:elevation="8dp"
android:gravity="center_vertical"
android:text="IP address:"
android:textColor="@color/dark_30" />
android:animateLayoutChanges="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/ipLabel"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@android:color/transparent"
android:elevation="8dp"
android:gravity="center_vertical"
android:text="IP address:"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:textColor="@color/dark_30" />
<Button
android:id="@+id/copyIp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="COPY"
app:layout_constraintEnd_toEndOf="parent"
android:background="@android:color/transparent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/ip"
android:layout_width="match_parent"
@ -47,15 +58,6 @@
app:layout_constraintEnd_toStartOf="@+id/copyIp"
android:text=""
android:textColor="@color/white"/>
<Button
android:id="@+id/copyIp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="COPY"
app:layout_constraintEnd_toEndOf="parent"
android:background="@android:color/transparent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>