update UI

master
Zhengyu Peng 3 years ago
parent 9759a51c41
commit ee5192138e

@ -398,20 +398,6 @@ class BluetoothService(context: Context?, handler: Handler) {
// given BluetoothDevice
try {
tmp = if (secure) {
// if (ActivityCompat.checkSelfPermission(
// this,
// Manifest.permission.BLUETOOTH_CONNECT
// ) != PackageManager.PERMISSION_GRANTED
// ) {
// // TODO: Consider calling
// // ActivityCompat#requestPermissions
// // here to request the missing permissions, and then overriding
// // public void onRequestPermissionsResult(int requestCode, String[] permissions,
// // int[] grantResults)
// // to handle the case where the user grants the permission. See the documentation
// // for ActivityCompat#requestPermissions for more details.
// return
// }
mmDevice.createRfcommSocketToServiceRecord(
MY_UUID_SECURE
)

@ -1,18 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_200"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:gravity="center_horizontal"
android:orientation="vertical"
android:gravity="center_horizontal">
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageView
android:id="@+id/hexapod_logo"
@ -26,14 +35,14 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toTopOf="@id/ip_input_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@id/ip_input_layout"
app:layout_constraintTop_toBottomOf="@+id/hexapod_logo">
<com.google.android.material.tabs.TabItem
@ -50,11 +59,39 @@
</com.google.android.material.tabs.TabLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
app:cardElevation="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/ip_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingTop="16dp"
android:visibility="visible"
app:errorEnabled="true"
app:layout_constraintBottom_toTopOf="@id/port_input_layout"
@ -76,6 +113,8 @@
android:id="@+id/port_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:layout_marginBottom="4dp"
android:visibility="visible"
app:errorEnabled="true"
@ -96,18 +135,23 @@
<include
android:id="@+id/selected"
android:visibility="visible"
layout="@layout/selected_device"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@+id/button_connect"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/port_input_layout" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<Button
android:id="@+id/button_connect"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:text="Connect"
@ -128,4 +172,5 @@
app:layout_constraintTop_toBottomOf="@+id/button_connect" />
</LinearLayout>
</LinearLayout>
</ScrollView>

@ -7,8 +7,8 @@
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:paddingTop="24dp"
android:paddingBottom="24dp">
android:paddingTop="16dp"
android:paddingBottom="16dp">
<ImageView
android:id="@+id/imageView"

Loading…
Cancel
Save