Joystick view

This commit is contained in:
Omer Schloss 2021-06-21 14:09:46 +03:00
parent b050bc316b
commit c5d2d762b4
10 changed files with 49 additions and 13 deletions

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectPlainTextFileTypeManager">
<file url="file://$PROJECT_DIR$/app/src/main/java/com/example/flightgearcontrollerapp/views/JoystickListener.kt" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>

View File

@ -5,7 +5,7 @@ plugins {
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.flightgearcontrollerapp"
minSdkVersion 26
@ -16,6 +16,9 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
dataBinding true
}
buildTypes {
release {
minifyEnabled false
@ -30,19 +33,16 @@ android {
jvmTarget = '1.8'
}
buildFeatures {
dataBinding true
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
implementation 'com.jackandphantom.android:joystickview:1.0.2'
//testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

View File

@ -0,0 +1,4 @@
package com.example.flightgearcontrollerapp.view_model
class JoyStickVM {
}

View File

@ -1,4 +1,5 @@
package com.example.flightgearcontrollerapp.views
class JoystickView{
}
class JoyStickView{
}

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M22,16v-2l-8.5,-5V3.5C13.5,2.67 12.83,2 12,2s-1.5,0.67 -1.5,1.5V9L2,14v2l8.5,-2.5V19L8,20.5L8,22l4,-1l4,1l0,-1.5L13.5,19v-5.5L22,16z"/>
</vector>

View File

@ -8,6 +8,12 @@
<variable
name="viewModel"
type="com.example.flightgearcontrollerapp.view_model.FGViewModel" />
<variable
name="joystickVM"
type="com.example.flightgearcontrollerapp.view_model.JoyStickVM"/>
<variable
name="model"
type="com.example.flightgearcontrollerapp.view_model.FGViewModel"/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
@ -127,13 +133,25 @@
<RelativeLayout
android:layout_width="360sp"
android:layout_height="370sp">
android:layout_height="370sp"
android:layout_gravity="center">
<RelativeLayout
<com.jackandphantom.joystickview.JoyStickView
android:id="@+id/widget_joystick"
android:layout_width="360sp"
android:layout_height="360sp"
android:layout_gravity="center" />
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="0dp"
android:layout_marginBottom="-3dp"
app:innerCircleColor="#f6FFFFFF"
app:innerCircleImage="@drawable/ic_baseline_airplanemode_active_24"
app:outerCircleBorderColor="#fff"
app:outerCircleBorderWidth="5"
app:outerCircleColor="@color/navy_blue_40"
app:shadowColor="#000"
app:shadowRadius="7" />
</RelativeLayout>
<GridLayout

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -11,4 +11,5 @@
<color name="white_60">#99FFFFFF</color>
<color name="white_40">#66FFFFFF</color>
<color name="navy_blue">#FF000080</color>
<color name="navy_blue_40">#66000080</color>
</resources>

View File

@ -1,4 +1,3 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.5.10"
repositories {
@ -8,7 +7,6 @@ buildscript {
dependencies {
classpath "com.android.tools.build:gradle:4.2.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
@ -18,6 +16,7 @@ allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}