bug fixed
This commit is contained in:
parent
5856277a14
commit
33ab56a376
@ -15,8 +15,6 @@ import com.example.flightgearcontrollerapp.view_model.FGViewModel
|
|||||||
|
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
//private var vmConnection: FGViewModel = FGViewModel()
|
|
||||||
private var isConnected = false
|
private var isConnected = false
|
||||||
private val vmConnection = FGViewModel()
|
private val vmConnection = FGViewModel()
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
<variable
|
<variable
|
||||||
@ -19,121 +19,121 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@mipmap/background"
|
android:background="@mipmap/background">
|
||||||
tools:context=".views.MainActivity">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
tools:context="com.setheightwidthpercentage_android_examples.com.MainActivity"
|
||||||
android:weightSum="100"
|
android:weightSum="100"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="0"
|
android:layout_weight="13"
|
||||||
android:orientation="vertical">
|
android:paddingTop="20dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
<TextView
|
android:text="@string/header_text"
|
||||||
android:layout_width="match_parent"
|
android:textColor="@color/white"
|
||||||
android:layout_height="wrap_content"
|
android:textSize="40sp"
|
||||||
android:paddingTop="30sp"
|
android:textStyle="bold|italic"
|
||||||
android:paddingBottom="10sp"
|
android:textAlignment="center"
|
||||||
android:text="@string/header_text"
|
android:gravity="center" />
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="41sp"
|
<TextView
|
||||||
android:textStyle="bold|italic"
|
android:id="@+id/text_ip"
|
||||||
android:textAlignment="center"
|
android:layout_width="match_parent"
|
||||||
android:gravity="center" />
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="6"
|
||||||
<TextView
|
android:text="@string/ask_ip"
|
||||||
android:id="@+id/text_ip"
|
android:textSize="20sp"
|
||||||
android:layout_width="match_parent"
|
android:textColor="@color/white"
|
||||||
android:layout_height="wrap_content"
|
android:paddingStart="15dp"
|
||||||
android:text="@string/ask_ip"
|
android:paddingEnd="15dp"
|
||||||
android:textSize="20sp"
|
android:paddingTop="5dp"
|
||||||
android:textColor="@color/white"
|
android:paddingBottom="5dp" />
|
||||||
android:paddingStart="15sp"
|
|
||||||
android:paddingEnd="15sp"
|
<EditText
|
||||||
android:paddingTop="5sp"
|
android:id="@+id/ip_address"
|
||||||
android:paddingBottom="5sp" />
|
android:labelFor="@id/ip_address"
|
||||||
|
android:layout_width="match_parent"
|
||||||
<EditText
|
android:layout_height="0sp"
|
||||||
android:id="@+id/ip_address"
|
android:layout_weight="6"
|
||||||
android:labelFor="@id/ip_address"
|
android:digits="0123456789."
|
||||||
android:layout_width="match_parent"
|
android:inputType="number|numberDecimal"
|
||||||
android:layout_height="wrap_content"
|
android:textSize="20sp"
|
||||||
android:digits="0123456789."
|
android:textDirection="ltr"
|
||||||
android:inputType="number|numberDecimal"
|
android:textColor="@color/white"
|
||||||
android:textSize="20sp"
|
android:theme="@android:style/Theme.Holo"
|
||||||
android:textDirection="ltr"
|
android:paddingLeft="15dp"
|
||||||
android:textColor="@color/white"
|
android:paddingRight="15dp"
|
||||||
android:theme="@android:style/Theme.Holo"
|
android:paddingTop="5dp"
|
||||||
android:paddingLeft="15sp"
|
android:paddingBottom="5dp"
|
||||||
android:paddingRight="15sp"
|
android:singleLine="true"
|
||||||
android:paddingTop="5sp"
|
android:nextFocusForward="@+id/port_address"
|
||||||
android:paddingBottom="5sp"
|
android:importantForAutofill="no" />
|
||||||
android:singleLine="true"
|
|
||||||
android:nextFocusForward="@+id/port_address"
|
<TextView
|
||||||
android:importantForAutofill="no" />
|
android:id="@+id/text_port"
|
||||||
|
android:layout_width="match_parent"
|
||||||
<TextView
|
android:layout_height="0sp"
|
||||||
android:id="@+id/text_port"
|
android:layout_weight="6"
|
||||||
android:layout_width="match_parent"
|
android:text="@string/ask_port"
|
||||||
android:layout_height="wrap_content"
|
android:textSize="20sp"
|
||||||
android:text="@string/ask_port"
|
android:textColor="@color/white"
|
||||||
android:textSize="20sp"
|
android:paddingLeft="15dp"
|
||||||
android:textColor="@color/white"
|
android:paddingRight="15dp"
|
||||||
android:paddingLeft="15sp"
|
android:paddingTop="5dp"
|
||||||
android:paddingRight="15sp"
|
android:paddingBottom="5dp" />
|
||||||
android:paddingTop="5sp"
|
|
||||||
android:paddingBottom="5sp" />
|
<EditText
|
||||||
|
android:id="@+id/port_address"
|
||||||
<EditText
|
android:labelFor="@id/port_address"
|
||||||
android:id="@+id/port_address"
|
android:layout_width="match_parent"
|
||||||
android:labelFor="@id/port_address"
|
android:layout_height="0sp"
|
||||||
android:layout_width="match_parent"
|
android:layout_weight="6"
|
||||||
android:layout_height="wrap_content"
|
android:digits="0123456789"
|
||||||
android:digits="0123456789"
|
android:inputType="number"
|
||||||
android:inputType="number"
|
android:textSize="20sp"
|
||||||
android:textSize="20sp"
|
android:textDirection="ltr"
|
||||||
android:textDirection="ltr"
|
android:theme="@android:style/Theme.Holo"
|
||||||
android:theme="@android:style/Theme.Holo"
|
android:paddingLeft="15dp"
|
||||||
android:paddingLeft="15sp"
|
android:paddingRight="15dp"
|
||||||
android:paddingRight="15sp"
|
android:paddingTop="4dp"
|
||||||
android:paddingTop="5sp"
|
android:paddingBottom="4dp"
|
||||||
android:paddingBottom="5sp"
|
|
||||||
|
android:importantForAutofill="no"
|
||||||
android:importantForAutofill="no"
|
android:singleLine="true" />
|
||||||
android:singleLine="true" />
|
|
||||||
|
<Button
|
||||||
<Button
|
android:id="@+id/btn_connect"
|
||||||
android:id="@+id/btn_connect"
|
android:textSize="20sp"
|
||||||
android:textSize="23sp"
|
android:textAllCaps="false"
|
||||||
android:textAllCaps="false"
|
android:paddingLeft="20dp"
|
||||||
android:paddingLeft="20sp"
|
android:paddingRight="20dp"
|
||||||
android:paddingRight="20sp"
|
android:paddingTop="12dp"
|
||||||
android:paddingTop="12sp"
|
android:paddingBottom="12dp"
|
||||||
android:paddingBottom="12sp"
|
android:layout_gravity="center"
|
||||||
android:layout_gravity="center"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_weight="9"
|
||||||
android:onClick="onClickConnect"
|
android:onClick="onClickConnect"
|
||||||
android:text="@string/btn_connect" />
|
android:text="@string/btn_connect" />
|
||||||
|
|
||||||
</LinearLayout>
|
<LinearLayout
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/throttle_slider"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_weight="80"
|
android:layout_height="0dp"
|
||||||
android:background="@color/black_60">
|
android:layout_weight="43"
|
||||||
|
tools:context="com.setheightwidthpercentage_android_examples.com.MainActivity"
|
||||||
|
android:weightSum="100"
|
||||||
|
android:background="@color/black_60"
|
||||||
|
android:baselineAligned="false">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="360sp"
|
android:layout_height="match_parent"
|
||||||
android:layout_height="370sp"
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="75"
|
||||||
android:layout_gravity="center">
|
android:layout_gravity="center">
|
||||||
|
|
||||||
<com.jackandphantom.joystickview.JoyStickView
|
<com.jackandphantom.joystickview.JoyStickView
|
||||||
@ -154,57 +154,59 @@
|
|||||||
app:shadowRadius="7" />
|
app:shadowRadius="7" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<GridLayout
|
<LinearLayout
|
||||||
|
|
||||||
android:layout_width="100sp"
|
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/white_40">
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="25"
|
||||||
|
tools:context="com.setheightwidthpercentage_android_examples.com.MainActivity"
|
||||||
|
android:weightSum="100"
|
||||||
|
android:background="@color/white_40"
|
||||||
|
android:orientation="vertical">
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_throttle"
|
android:id="@+id/text_throttle"
|
||||||
android:layout_width="100sp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="66sp"
|
android:layout_height="0dp"
|
||||||
android:layout_row="0"
|
android:layout_weight="20"
|
||||||
android:layout_column="1"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/txt_throttle"
|
android:text="@string/txt_throttle"
|
||||||
android:textColor="@color/black_60"
|
android:textColor="@color/black_60"
|
||||||
android:textSize="20sp"
|
android:autoSizeTextType="uniform"
|
||||||
android:textStyle="bold" />
|
android:autoSizeMaxTextSize="20sp"
|
||||||
|
android:textStyle="bold"/>
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="230dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="80"
|
||||||
|
android:layout_marginStart="-65dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<com.google.android.material.slider.Slider
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_width="320sp"
|
android:layout_height="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:rotation="270"
|
||||||
android:layout_row="1"
|
android:value="0"
|
||||||
android:layout_column="1"
|
android:valueFrom="0"
|
||||||
android:layout_marginLeft="-110sp"
|
android:valueTo="1" />
|
||||||
android:layout_marginTop="120sp"
|
</RelativeLayout>
|
||||||
android:rotation="270"
|
</LinearLayout>
|
||||||
android:value="0"
|
|
||||||
android:valueFrom="0"
|
|
||||||
android:valueTo="1" />
|
|
||||||
</GridLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="11"
|
||||||
android:background="@color/white_40"
|
android:background="@color/white_40"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
android:paddingTop="5sp"
|
|
||||||
android:paddingBottom="5sp">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_rudder"
|
android:id="@+id/text_rudder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:paddingLeft="15sp"
|
android:paddingLeft="15dp"
|
||||||
android:paddingTop="5sp"
|
android:paddingRight="15dp"
|
||||||
android:paddingRight="15sp"
|
|
||||||
android:paddingBottom="0sp"
|
|
||||||
android:text="@string/txt_rudder"
|
android:text="@string/txt_rudder"
|
||||||
android:textColor="@color/black_60"
|
android:textColor="@color/black_60"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
@ -212,10 +214,9 @@
|
|||||||
|
|
||||||
<com.google.android.material.slider.Slider
|
<com.google.android.material.slider.Slider
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginLeft="30sp"
|
android:layout_marginLeft="30dp"
|
||||||
android:layout_marginRight="30sp"
|
android:layout_marginRight="30dp"
|
||||||
android:layout_height="0sp"
|
android:layout_height="fill_parent"
|
||||||
android:layout_weight="0"
|
|
||||||
app:trackColorActive="@color/navy_blue_40"
|
app:trackColorActive="@color/navy_blue_40"
|
||||||
app:trackColorInactive="@color/navy_blue_40"
|
app:trackColorInactive="@color/navy_blue_40"
|
||||||
android:value="0"
|
android:value="0"
|
||||||
|
Loading…
Reference in New Issue
Block a user