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) val copyAddressButton = findViewById<Button>(R.id.copyIp)
copyAddressButton.setOnClickListener { copyAddressButton.setOnClickListener {
val ipLabel = findViewById<TextView>(R.id.ipLabel) val ip = findViewById<TextView>(R.id.ip)
val clipboard: ClipboardManager = val clipboard: ClipboardManager =
getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = val clip =
ClipData.newPlainText("IP address", ipLabel.text.toString()) ClipData.newPlainText("IP address", ip.text.toString())
clipboard.setPrimaryClip(clip) clipboard.setPrimaryClip(clip)
showToast(getString(R.string.address_copied)) showToast(getString(R.string.address_copied))
} }

View File

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