Browse Source

Android App starten

master
Baran Yasar 1 year ago
parent
commit
4d800c36fe
88 changed files with 3021 additions and 0 deletions
  1. 15
    0
      MobileApp/.gitignore
  2. 1
    0
      MobileApp/app/.gitignore
  3. 45
    0
      MobileApp/app/build.gradle
  4. 21
    0
      MobileApp/app/proguard-rules.pro
  5. 26
    0
      MobileApp/app/src/androidTest/java/com/example/lfrmobileapp/ExampleInstrumentedTest.java
  6. 28
    0
      MobileApp/app/src/main/AndroidManifest.xml
  7. 37
    0
      MobileApp/app/src/main/java/com/example/lfrmobileapp/MainActivity.java
  8. 37
    0
      MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/dashboard/DashboardFragment.java
  9. 19
    0
      MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/dashboard/DashboardViewModel.java
  10. 53
    0
      MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/home/HomeFragment.java
  11. 24
    0
      MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/home/HomeViewModel.java
  12. 37
    0
      MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/notifications/NotificationsFragment.java
  13. 19
    0
      MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/notifications/NotificationsViewModel.java
  14. 11
    0
      MobileApp/app/src/main/res/drawable-anydpi/automatik.xml
  15. 11
    0
      MobileApp/app/src/main/res/drawable-anydpi/einstellungen.xml
  16. 14
    0
      MobileApp/app/src/main/res/drawable-anydpi/manuell.xml
  17. BIN
      MobileApp/app/src/main/res/drawable-hdpi/automatik.png
  18. BIN
      MobileApp/app/src/main/res/drawable-hdpi/einstellungen.png
  19. BIN
      MobileApp/app/src/main/res/drawable-hdpi/manuell.png
  20. BIN
      MobileApp/app/src/main/res/drawable-mdpi/automatik.png
  21. BIN
      MobileApp/app/src/main/res/drawable-mdpi/einstellungen.png
  22. BIN
      MobileApp/app/src/main/res/drawable-mdpi/manuell.png
  23. 30
    0
      MobileApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
  24. BIN
      MobileApp/app/src/main/res/drawable-xhdpi/automatik.png
  25. BIN
      MobileApp/app/src/main/res/drawable-xhdpi/einstellungen.png
  26. BIN
      MobileApp/app/src/main/res/drawable-xhdpi/manuell.png
  27. BIN
      MobileApp/app/src/main/res/drawable-xxhdpi/automatik.png
  28. BIN
      MobileApp/app/src/main/res/drawable-xxhdpi/einstellungen.png
  29. BIN
      MobileApp/app/src/main/res/drawable-xxhdpi/manuell.png
  30. 5
    0
      MobileApp/app/src/main/res/drawable/ic_baseline_rotate_left_24.xml
  31. 5
    0
      MobileApp/app/src/main/res/drawable/ic_baseline_rotate_right_24.xml
  32. 9
    0
      MobileApp/app/src/main/res/drawable/ic_dashboard_black_24dp.xml
  33. 9
    0
      MobileApp/app/src/main/res/drawable/ic_home_black_24dp.xml
  34. 170
    0
      MobileApp/app/src/main/res/drawable/ic_launcher_background.xml
  35. 9
    0
      MobileApp/app/src/main/res/drawable/ic_notifications_black_24dp.xml
  36. 32
    0
      MobileApp/app/src/main/res/layout/activity_main.xml
  37. 72
    0
      MobileApp/app/src/main/res/layout/fragment_automatik.xml
  38. 22
    0
      MobileApp/app/src/main/res/layout/fragment_einstellungen.xml
  39. 61
    0
      MobileApp/app/src/main/res/layout/fragment_manuell.xml
  40. 19
    0
      MobileApp/app/src/main/res/menu/bottom_nav_menu.xml
  41. 5
    0
      MobileApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
  42. 5
    0
      MobileApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
  43. BIN
      MobileApp/app/src/main/res/mipmap-hdpi/ic_launcher.webp
  44. BIN
      MobileApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
  45. BIN
      MobileApp/app/src/main/res/mipmap-mdpi/ic_launcher.webp
  46. BIN
      MobileApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
  47. BIN
      MobileApp/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
  48. BIN
      MobileApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
  49. BIN
      MobileApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
  50. BIN
      MobileApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
  51. BIN
      MobileApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
  52. BIN
      MobileApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
  53. 25
    0
      MobileApp/app/src/main/res/navigation/mobile_navigation.xml
  54. 15
    0
      MobileApp/app/src/main/res/values-night/themes.xml
  55. 13
    0
      MobileApp/app/src/main/res/values/colors.xml
  56. 5
    0
      MobileApp/app/src/main/res/values/dimens.xml
  57. 7
    0
      MobileApp/app/src/main/res/values/strings.xml
  58. 29
    0
      MobileApp/app/src/main/res/values/themes.xml
  59. 13
    0
      MobileApp/app/src/main/res/xml/backup_rules.xml
  60. 19
    0
      MobileApp/app/src/main/res/xml/data_extraction_rules.xml
  61. 17
    0
      MobileApp/app/src/test/java/com/example/lfrmobileapp/ExampleUnitTest.java
  62. 9
    0
      MobileApp/build.gradle
  63. 21
    0
      MobileApp/gradle.properties
  64. BIN
      MobileApp/gradle/wrapper/gradle-wrapper.jar
  65. 6
    0
      MobileApp/gradle/wrapper/gradle-wrapper.properties
  66. 185
    0
      MobileApp/gradlew
  67. 89
    0
      MobileApp/gradlew.bat
  68. 22
    0
      MobileApp/settings.gradle
  69. 7
    0
      MobileApp/virtual-joystick-android-master/.gitignore
  70. 202
    0
      MobileApp/virtual-joystick-android-master/LICENSE
  71. 187
    0
      MobileApp/virtual-joystick-android-master/README.md
  72. 28
    0
      MobileApp/virtual-joystick-android-master/build.gradle
  73. 18
    0
      MobileApp/virtual-joystick-android-master/gradle.properties
  74. BIN
      MobileApp/virtual-joystick-android-master/gradle/wrapper/gradle-wrapper.jar
  75. 6
    0
      MobileApp/virtual-joystick-android-master/gradle/wrapper/gradle-wrapper.properties
  76. 160
    0
      MobileApp/virtual-joystick-android-master/gradlew
  77. 90
    0
      MobileApp/virtual-joystick-android-master/gradlew.bat
  78. BIN
      MobileApp/virtual-joystick-android-master/misc/android-virtual-joystick-custom-image.png
  79. BIN
      MobileApp/virtual-joystick-android-master/misc/virtual-joystick-android.png
  80. BIN
      MobileApp/virtual-joystick-android-master/misc/virtual-joystick.png
  81. 1
    0
      MobileApp/virtual-joystick-android-master/settings.gradle
  82. 1
    0
      MobileApp/virtual-joystick-android-master/virtualjoystick/.gitignore
  83. 47
    0
      MobileApp/virtual-joystick-android-master/virtualjoystick/build.gradle
  84. 17
    0
      MobileApp/virtual-joystick-android-master/virtualjoystick/proguard-rules.pro
  85. 5
    0
      MobileApp/virtual-joystick-android-master/virtualjoystick/src/main/AndroidManifest.xml
  86. 871
    0
      MobileApp/virtual-joystick-android-master/virtualjoystick/src/main/java/io/github/controlwear/virtual/joystick/android/JoystickView.java
  87. 40
    0
      MobileApp/virtual-joystick-android-master/virtualjoystick/src/main/res/values/attrs.xml
  88. 15
    0
      MobileApp/virtual-joystick-android-master/virtualjoystick/src/test/java/io/github/controlwear/virtual/joystick/android/ExampleUnitTest.java

+ 15
- 0
MobileApp/.gitignore View File

@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

+ 1
- 0
MobileApp/app/.gitignore View File

@@ -0,0 +1 @@
/build

+ 45
- 0
MobileApp/app/build.gradle View File

@@ -0,0 +1,45 @@
plugins {
id 'com.android.application'
}

android {
compileSdk 32

defaultConfig {
applicationId "com.example.lfrmobileapp"
minSdk 22
targetSdk 32
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.navigation:navigation-fragment:2.5.3'
implementation 'androidx.navigation:navigation-ui:2.5.3'
implementation project(path: ':virtualjoystick')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

+ 21
- 0
MobileApp/app/proguard-rules.pro View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

+ 26
- 0
MobileApp/app/src/androidTest/java/com/example/lfrmobileapp/ExampleInstrumentedTest.java View File

@@ -0,0 +1,26 @@
package com.example.lfrmobileapp;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.lfrmobileapp", appContext.getPackageName());
}
}

+ 28
- 0
MobileApp/app/src/main/AndroidManifest.xml View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.lfrmobileapp">

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.LFRMobileApp"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

+ 37
- 0
MobileApp/app/src/main/java/com/example/lfrmobileapp/MainActivity.java View File

@@ -0,0 +1,37 @@
package com.example.lfrmobileapp;

import android.os.Bundle;

import com.google.android.material.bottomnavigation.BottomNavigationView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;

import com.example.lfrmobileapp.databinding.ActivityMainBinding;

public class MainActivity extends AppCompatActivity {

private ActivityMainBinding binding;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());

BottomNavigationView navView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main);
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
NavigationUI.setupWithNavController(binding.navView, navController);
}

}

+ 37
- 0
MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/dashboard/DashboardFragment.java View File

@@ -0,0 +1,37 @@
package com.example.lfrmobileapp.ui.dashboard;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;

import com.example.lfrmobileapp.databinding.FragmentAutomatikBinding;

public class DashboardFragment extends Fragment {

private FragmentAutomatikBinding binding;

public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
DashboardViewModel dashboardViewModel =
new ViewModelProvider(this).get(DashboardViewModel.class);

binding = FragmentAutomatikBinding.inflate(inflater, container, false);
View root = binding.getRoot();

final TextView textView = binding.textDashboard;
dashboardViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
return root;
}

@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

+ 19
- 0
MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/dashboard/DashboardViewModel.java View File

@@ -0,0 +1,19 @@
package com.example.lfrmobileapp.ui.dashboard;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

public class DashboardViewModel extends ViewModel {

private final MutableLiveData<String> mText;

public DashboardViewModel() {
mText = new MutableLiveData<>();
mText.setValue("");
}

public LiveData<String> getText() {
return mText;
}
}

+ 53
- 0
MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/home/HomeFragment.java View File

@@ -0,0 +1,53 @@
package com.example.lfrmobileapp.ui.home;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;

import com.example.lfrmobileapp.databinding.FragmentManuellBinding;

import io.github.controlwear.virtual.joystick.android.JoystickView;

public class HomeFragment extends Fragment {

private FragmentManuellBinding binding;

public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
HomeViewModel homeViewModel =
new ViewModelProvider(this).get(HomeViewModel.class);

binding = FragmentManuellBinding.inflate(inflater, container, false);
View root = binding.getRoot();

final TextView textView = binding.textHome;
homeViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);

JoystickView joystick = (JoystickView) binding.joystick;
joystick.setOnMoveListener(new JoystickView.OnMoveListener() {
@Override
public void onMove(int angle, int strength) {
homeViewModel.setText(Integer.toString(angle), Integer.toString(strength));
}
});

return root;
}

@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}


}

+ 24
- 0
MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/home/HomeViewModel.java View File

@@ -0,0 +1,24 @@
package com.example.lfrmobileapp.ui.home;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

public class HomeViewModel extends ViewModel {

private final MutableLiveData<String> mText;

public HomeViewModel() {
mText = new MutableLiveData<>();
mText.setValue("Bewege den Punkt zum steuern des Roboters");
}

public LiveData<String>setText(String angle, String strength){
mText.setValue("Winkel: "+ angle + " Verstärkung: " + strength);
return mText;
};

public LiveData<String> getText() {
return mText;
}
}

+ 37
- 0
MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/notifications/NotificationsFragment.java View File

@@ -0,0 +1,37 @@
package com.example.lfrmobileapp.ui.notifications;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;

import com.example.lfrmobileapp.databinding.FragmentEinstellungenBinding;

public class NotificationsFragment extends Fragment {

private FragmentEinstellungenBinding binding;

public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
NotificationsViewModel notificationsViewModel =
new ViewModelProvider(this).get(NotificationsViewModel.class);

binding = FragmentEinstellungenBinding.inflate(inflater, container, false);
View root = binding.getRoot();

final TextView textView = binding.textNotifications;
notificationsViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
return root;
}

@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

+ 19
- 0
MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/notifications/NotificationsViewModel.java View File

@@ -0,0 +1,19 @@
package com.example.lfrmobileapp.ui.notifications;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

public class NotificationsViewModel extends ViewModel {

private final MutableLiveData<String> mText;

public NotificationsViewModel() {
mText = new MutableLiveData<>();
mText.setValue("");
}

public LiveData<String> getText() {
return mText;
}
}

+ 11
- 0
MobileApp/app/src/main/res/drawable-anydpi/automatik.xml View File

@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#333333"
android:alpha="0.6">
<path
android:fillColor="@android:color/white"
android:pathData="M17,16l-4,-4V8.82C14.16,8.4 15,7.3 15,6c0,-1.66 -1.34,-3 -3,-3S9,4.34 9,6c0,1.3 0.84,2.4 2,2.82V12l-4,4H3v5h5v-3.05l4,-4.2 4,4.2V21h5v-5h-4z"/>
</vector>

+ 11
- 0
MobileApp/app/src/main/res/drawable-anydpi/einstellungen.xml View File

@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#333333"
android:alpha="0.6">
<path
android:fillColor="@android:color/white"
android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
</vector>

+ 14
- 0
MobileApp/app/src/main/res/drawable-anydpi/manuell.xml View File

@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#333333"
android:alpha="0.6">
<path
android:fillColor="@android:color/white"
android:pathData="M15.54,5.54L13.77,7.3 12,5.54 10.23,7.3 8.46,5.54 12,2zM18.46,15.54l-1.76,-1.77L18.46,12l-1.76,-1.77 1.76,-1.77L22,12zM8.46,18.46l1.77,-1.76L12,18.46l1.77,-1.76 1.77,1.76L12,22zM5.54,8.46l1.76,1.77L5.54,12l1.76,1.77 -1.76,1.77L2,12z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M12,12m-3,0a3,3 0,1 1,6 0a3,3 0,1 1,-6 0"/>
</vector>

BIN
MobileApp/app/src/main/res/drawable-hdpi/automatik.png View File


BIN
MobileApp/app/src/main/res/drawable-hdpi/einstellungen.png View File


BIN
MobileApp/app/src/main/res/drawable-hdpi/manuell.png View File


BIN
MobileApp/app/src/main/res/drawable-mdpi/automatik.png View File


BIN
MobileApp/app/src/main/res/drawable-mdpi/einstellungen.png View File


BIN
MobileApp/app/src/main/res/drawable-mdpi/manuell.png View File


+ 30
- 0
MobileApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml View File

@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

BIN
MobileApp/app/src/main/res/drawable-xhdpi/automatik.png View File


BIN
MobileApp/app/src/main/res/drawable-xhdpi/einstellungen.png View File


BIN
MobileApp/app/src/main/res/drawable-xhdpi/manuell.png View File


BIN
MobileApp/app/src/main/res/drawable-xxhdpi/automatik.png View File


BIN
MobileApp/app/src/main/res/drawable-xxhdpi/einstellungen.png View File


BIN
MobileApp/app/src/main/res/drawable-xxhdpi/manuell.png View File


+ 5
- 0
MobileApp/app/src/main/res/drawable/ic_baseline_rotate_left_24.xml View File

@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#3C3F41"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M7.11,8.53L5.7,7.11C4.8,8.27 4.24,9.61 4.07,11h2.02c0.14,-0.87 0.49,-1.72 1.02,-2.47zM6.09,13L4.07,13c0.17,1.39 0.72,2.73 1.62,3.89l1.41,-1.42c-0.52,-0.75 -0.87,-1.59 -1.01,-2.47zM7.1,18.32c1.16,0.9 2.51,1.44 3.9,1.61L11,17.9c-0.87,-0.15 -1.71,-0.49 -2.46,-1.03L7.1,18.32zM13,4.07L13,1L8.45,5.55 13,10L13,6.09c2.84,0.48 5,2.94 5,5.91s-2.16,5.43 -5,5.91v2.02c3.95,-0.49 7,-3.85 7,-7.93s-3.05,-7.44 -7,-7.93z"/>
</vector>

+ 5
- 0
MobileApp/app/src/main/res/drawable/ic_baseline_rotate_right_24.xml View File

@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#3C3F41"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M15.55,5.55L11,1v3.07C7.06,4.56 4,7.92 4,12s3.05,7.44 7,7.93v-2.02c-2.84,-0.48 -5,-2.94 -5,-5.91s2.16,-5.43 5,-5.91L11,10l4.55,-4.45zM19.93,11c-0.17,-1.39 -0.72,-2.73 -1.62,-3.89l-1.42,1.42c0.54,0.75 0.88,1.6 1.02,2.47h2.02zM13,17.9v2.02c1.39,-0.17 2.74,-0.71 3.9,-1.61l-1.44,-1.44c-0.75,0.54 -1.59,0.89 -2.46,1.03zM16.89,15.48l1.42,1.41c0.9,-1.16 1.45,-2.5 1.62,-3.89h-2.02c-0.14,0.87 -0.48,1.72 -1.02,2.48z"/>
</vector>

+ 9
- 0
MobileApp/app/src/main/res/drawable/ic_dashboard_black_24dp.xml View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M3,13h8L11,3L3,3v10zM3,21h8v-6L3,15v6zM13,21h8L21,11h-8v10zM13,3v6h8L21,3h-8z" />
</vector>

+ 9
- 0
MobileApp/app/src/main/res/drawable/ic_home_black_24dp.xml View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" />
</vector>

+ 170
- 0
MobileApp/app/src/main/res/drawable/ic_launcher_background.xml View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

+ 9
- 0
MobileApp/app/src/main/res/drawable/ic_notifications_black_24dp.xml View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2zM18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2z" />
</vector>

+ 32
- 0
MobileApp/app/src/main/res/layout/activity_main.xml View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:background="?android:attr/windowBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/bottom_nav_menu" />

<fragment
android:id="@+id/nav_host_fragment_activity_main"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:defaultNavHost="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/mobile_navigation" />

</androidx.constraintlayout.widget.ConstraintLayout>

+ 72
- 0
MobileApp/app/src/main/res/layout/fragment_automatik.xml View File

@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.dashboard.DashboardFragment">

<Switch
android:id="@+id/startAutomatic"
android:layout_width="224dp"
android:layout_height="38dp"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="16dp"
android:checked="false"
android:fontFamily="sans-serif-medium"
android:text="Roboter aktivieren "
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"></Switch>

<TextView
android:id="@+id/text_dashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.946" />

<TextView
android:id="@+id/textTurnLeftRight"
android:layout_width="128dp"
android:layout_height="22dp"
android:layout_marginStart="8dp"
android:layout_marginTop="68dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-medium"
android:text="Abbiegen nach "
android:textColor="#000000"
android:textSize="16sp"

app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.322"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ToggleButton
android:id="@+id/toggleButton"
android:layout_width="95dp"
android:layout_height="40dp"
android:layout_marginTop="60dp"
android:layout_marginEnd="16dp"
android:fontFamily="sans-serif-medium"
android:text="ToggleButton"
android:textOff="Links"
android:textOn="Rechts"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.74"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

+ 22
- 0
MobileApp/app/src/main/res/layout/fragment_einstellungen.xml View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.notifications.NotificationsFragment">

<TextView
android:id="@+id/text_notifications"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

+ 61
- 0
MobileApp/app/src/main/res/layout/fragment_manuell.xml View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.home.HomeFragment">

<io.github.controlwear.virtual.joystick.android.JoystickView
android:id="@+id/joystick"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:JV_backgroundColor="@color/THblue"
app:JV_borderColor="#000000"
app:JV_borderWidth="2dp"
app:JV_buttonColor="#FFFFFF"
app:JV_buttonSizeRatio="13%"
app:JV_fixedCenter="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/text_home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />

<Button
android:id="@+id/rotateLeft"
android:layout_width="140dp"
android:layout_height="140dp"
android:layout_marginTop="325dp"
android:background="@drawable/ic_baseline_rotate_left_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.150"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"></Button>

<Button
android:id="@+id/rotateRight"
android:layout_width="140dp"
android:layout_height="140dp"
android:layout_marginTop="325dp"
android:background="@drawable/ic_baseline_rotate_right_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.85"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"></Button>
</androidx.constraintlayout.widget.ConstraintLayout>

+ 19
- 0
MobileApp/app/src/main/res/menu/bottom_nav_menu.xml View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<item
android:id="@+id/navigation_home"
android:icon="@drawable/manuell"
android:title="@string/title_home" />

<item
android:id="@+id/navigation_dashboard"
android:icon="@drawable/automatik"
android:title="@string/title_dashboard" />

<item
android:id="@+id/navigation_notifications"
android:icon="@drawable/einstellungen"
android:title="@string/title_notifications" />

</menu>

+ 5
- 0
MobileApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

+ 5
- 0
MobileApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

BIN
MobileApp/app/src/main/res/mipmap-hdpi/ic_launcher.webp View File


BIN
MobileApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp View File


BIN
MobileApp/app/src/main/res/mipmap-mdpi/ic_launcher.webp View File


BIN
MobileApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp View File


BIN
MobileApp/app/src/main/res/mipmap-xhdpi/ic_launcher.webp View File


BIN
MobileApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp View File


BIN
MobileApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp View File


BIN
MobileApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp View File


BIN
MobileApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp View File


BIN
MobileApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp View File


+ 25
- 0
MobileApp/app/src/main/res/navigation/mobile_navigation.xml View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mobile_navigation"
app:startDestination="@+id/navigation_home">

<fragment
android:id="@+id/navigation_home"
android:name="com.example.lfrmobileapp.ui.home.HomeFragment"
android:label="@string/app_name"
tools:layout="@layout/fragment_manuell" />

<fragment
android:id="@+id/navigation_dashboard"
android:name="com.example.lfrmobileapp.ui.dashboard.DashboardFragment"
android:label="@string/app_name"
tools:layout="@layout/fragment_automatik" />

<fragment
android:id="@+id/navigation_notifications"
android:name="com.example.lfrmobileapp.ui.notifications.NotificationsFragment"
android:label="@string/app_name"
tools:layout="@layout/fragment_einstellungen" />
</navigation>

+ 15
- 0
MobileApp/app/src/main/res/values-night/themes.xml View File

@@ -0,0 +1,15 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.LFRMobileApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->

<!-- Customize your theme here. -->
</style>
</resources>

+ 13
- 0
MobileApp/app/src/main/res/values/colors.xml View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="THblue">#0046A0</color>


</resources>

+ 5
- 0
MobileApp/app/src/main/res/values/dimens.xml View File

@@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

+ 7
- 0
MobileApp/app/src/main/res/values/strings.xml View File

@@ -0,0 +1,7 @@
<resources>
<string name="app_name">Line-Following-Robot 2.0</string>
<string name="title_home">Manuell</string>
<string name="title_dashboard">Automatik</string>
<string name="title_notifications">Einstellungen</string>
<string name="crossroad_type">Kreuzungstyp</string>
</resources>

+ 29
- 0
MobileApp/app/src/main/res/values/themes.xml View File

@@ -0,0 +1,29 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.LFRMobileApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/THblue</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->

<item name="colorControlActivated">@color/THblue</item>
<!-- inactive thumb color -->
<item name="colorSwitchThumbNormal">#f1f1f1
</item>
<!-- inactive track color (30% transparency) -->
<item name="android:colorForeground">#42221f1f
</item>
</style>
<style name="Button.White" parent="ThemeOverlay.AppCompat">
<item name="colorAccent">@android:color/white</item>
</style>


</resources>

+ 13
- 0
MobileApp/app/src/main/res/xml/backup_rules.xml View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

+ 19
- 0
MobileApp/app/src/main/res/xml/data_extraction_rules.xml View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

+ 17
- 0
MobileApp/app/src/test/java/com/example/lfrmobileapp/ExampleUnitTest.java View File

@@ -0,0 +1,17 @@
package com.example.lfrmobileapp;

import org.junit.Test;

import static org.junit.Assert.*;

/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

+ 9
- 0
MobileApp/build.gradle View File

@@ -0,0 +1,9 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.0' apply false
id 'com.android.library' version '7.2.0' apply false
}

task clean(type: Delete) {
delete rootProject.buildDir
}

+ 21
- 0
MobileApp/gradle.properties View File

@@ -0,0 +1,21 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

BIN
MobileApp/gradle/wrapper/gradle-wrapper.jar View File


+ 6
- 0
MobileApp/gradle/wrapper/gradle-wrapper.properties View File

@@ -0,0 +1,6 @@
#Sat Jan 07 18:41:59 CET 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

+ 185
- 0
MobileApp/gradlew View File

@@ -0,0 +1,185 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn () {
echo "$*"
}

die () {
echo
echo "$*"
echo
exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option

if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

exec "$JAVACMD" "$@"

+ 89
- 0
MobileApp/gradlew.bat View File

@@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega

+ 22
- 0
MobileApp/settings.gradle View File

@@ -0,0 +1,22 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
rootProject.name = "LFRMobileApp"
include ':app'


include ':virtualjoystick'
project(':virtualjoystick').projectDir = new File(rootDir, 'virtual-joystick-android-master/virtualjoystick/')
include ':virtualjoystick'

+ 7
- 0
MobileApp/virtual-joystick-android-master/.gitignore View File

@@ -0,0 +1,7 @@
*.iml
.gradle
/local.properties
.idea
.DS_Store
/build
/captures

+ 202
- 0
MobileApp/virtual-joystick-android-master/LICENSE View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright {yyyy} {name of copyright owner}

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


+ 187
- 0
MobileApp/virtual-joystick-android-master/README.md View File

@@ -0,0 +1,187 @@
# virtual-joystick-android

**v1.10.1** _(New version - [support custom images](#image), button & background size, limited direction, normalized coordinate, alpha border)_

_I created this very simple library as a learning process and I have been inspired by this project [JoystickView](https://github.com/zerokol/JoystickView) (the author is a genius!)_

This library provides a very simple and **ready-to-use** custom view which emulates a joystick for Android.

![Alt text](/misc/virtual-joystick-android.png?raw=true "Double Joystick with custom size and colors")

### Gist
Here is a very simple snippets to use it. Just set the `onMoveListener` to retrieve its angle and strength.

```java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

...

JoystickView joystick = (JoystickView) findViewById(R.id.joystickView);
joystick.setOnMoveListener(new JoystickView.OnMoveListener() {
@Override
public void onMove(int angle, int strength) {
// do whatever you want
}
});
}
```
The **angle** follow the rules of a simple **counter-clock** protractor. The **strength is percentage** of how far the button is **from the center to the border**.

![Alt text](/misc/virtual-joystick.png?raw=true "Explanation")

By default the **refresh rate** to get the data is **20/sec (every 50ms)**. If you want more or less just set the listener with one more parameters to set the refresh rate in milliseconds.
```java
joystick.setOnMoveListener(new JoystickView.OnMoveListener() { ... }, 17); // around 60/sec
```

### Attributes

You can customize the joystick according to these attributes `JV_buttonImage`, `JV_buttonColor`, `JV_buttonSizeRatio`, `JV_borderColor`, `JV_borderAlpha`, `JV_borderWidth`, `JV_backgroundColor`, `JV_backgroundSizeRatio`, `JV_fixedCenter`, `JV_autoReCenterButton`, `JV_buttonStickToBorder`, `JV_enabled` and `JV_buttonDirection`

If you specified `JV_buttonImage` you don't need `JV_buttonColor`

Here is an example for your layout resources:
```xml
<io.github.controlwear.virtual.joystick.android.JoystickView
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:JV_buttonColor="#FF6E40"
custom:JV_buttonSizeRatio="15%"
custom:JV_borderColor="#00796B"
custom:JV_backgroundColor="#009688"
custom:JV_borderWidth="4dp"
custom:JV_fixedCenter="false"/>
```
#### Image
If you want a more customized joystick, you can use `JV_buttonImage` and the regular `background` attributes to specify drawables. The images will be automatically resized.

```xml
<io.github.controlwear.virtual.joystick.android.JoystickView
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/joystick_base_blue"
custom:JV_buttonImage="@drawable/ball_pink"/>
```

![Alt text](/misc/android-virtual-joystick-custom-image.png?raw=true "Left joystick with custom image")

#### SizeRatio
We can change the default size of the button and background.
The size is calculated as a percentage of the total width/height.

By default, the button is 25% (0.25) and the background 75% (0.25), as the first screenshot above.

If the total (background + button) is above 1.0, the button will probably be a bit cut when on the border.

```xml
<...
custom:JV_buttonSizeRatio="50%"
custom:JV_backgroundSizeRatio="10%"/>

```

```java
joystick.setBackgroundSizeRatio(0.5);
joystick.setButtonSizeRatio(0.1);
```

_The background size is not working for a custom picture._

#### FixedCenter or Not? (and auto re-center)
If you don’t set up this parameter, it will be FixedCenter by default, which is the regular behavior.

However, sometimes, it is convenient to have an auto-defined center which will be defined each time you touch down the screen with your finger (center position will be limited inside the JoystickView’s width/height).
As every parameter you can set it up in xml (as above) or in Java:
```java
joystick.setFixedCenter(false); // set up auto-define center
```

UnfixedCenter (set to false) is particularly convenient when the user can’t (or doesn’t want to) see the screen (e.g. a drone's controller).

We can also remove the automatically re-centered button, just set it to false.
```java
joystick.setAutoReCenterButton(false);
```
_(The behavior is a bit weird if we set remove both the FixedCenter and the AutoReCenter.)_

#### Enabled
By default the joystick is enabled (set to True), but you can disable it either in xml or Java. Then, the button will stop moving and `onMove()` won’t be called anymore.
```java
joystick.setEnabled(false); // disabled the joystick
joystick.isEnabled(); // return enabled state
```

#### ButtonDirection
By default the button can move in both direction X,Y (regular behavior), but we can limit the movement through one axe horizontal or vertical.
```xml
<...
custom:JV_buttonDirection="horizontal"/>
```
In the layout file (xml), this option can be set to `horizontal`, `vertical` or `both`.

We can also set this option in the Java file by setting an integer value:
- any negative value (e.g. -1) for the horizontal axe
- any positive value (e.g. 1) for the vertical axe
- zero (0) for both (which is the default option)

```java
joystick.setButtonDirection(1); // vertical
```

### Wearable
If you use this library in Wearable app, you will probably disable the Swipe-To-Dismiss Gesture and implement the Long Press to Dismiss Pattern, which could be a problem for a Joystick Pattern (because we usually let the user touch the joystick as long as she/he wants), in that case you can set another convenient listener: `OnMultipleLongPressListener` which will be invoked only with multiple pointers (at least two fingers) instead of one.
```java
joystick.setOnMultiLongPressListener(new JoystickView.OnMultipleLongPressListener() {
@Override
public void onMultipleLongPress() {
... // eg. mDismissOverlay.show();
}
});
```
Or better, if you just want a simple Joystick (and few other cool stuff) as a controller for your mobile app you can use the following related project ;)

## Demo
For those who want more than just a snippet, here is the demo :
- [Basic two joysticks ](https://github.com/controlwear/virtual-joystick-demo) (similar to screenshot)

If you want to add your project here, go ahead :)

## Required
Minimum API level is 16 (Android 4.1.x - Jelly Bean) which cover 99.5% of the Android platforms as of October 2018 according to the <a href="https://developer.android.com/about/dashboards" class="user-mention">distribution dashboard</a>.

## Download
### Gradle
```java
compile 'io.github.controlwear:virtualjoystick:1.10.1'
```

## Contributing
If you would like to contribute code, you can do so through GitHub by forking the repository and sending a pull request.
When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible.

## License
```
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```

## Authors

**virtual-joystick-android** is an open source project created by <a href="https://github.com/makowildcat" class="user-mention">@makowildcat</a> (mostly spare time) and partially funded by [Black Artick](http://blackartick.com/) and [NSERC](http://www.nserc-crsng.gc.ca/index_eng.asp).

Also, thanks to <a href="https://github.com/Bernix01" class="user-mention">Bernix01</a>, <a href="https://github.com/teancake" class="user-mention">teancake</a>, <a href="https://github.com/Spettacolo83" class="user-mention">Spettacolo83</a>, <a href="https://github.com/djjaysmith" class="user-mention">djjaysmith</a>, <a href="https://github.com/jaybkim1" class="user-mention">jaybkim1</a>, <a href="https://github.com/sikrinick" class="user-mention">sikrinick</a>, <a href="https://github.com/AlexandrDavydov" class="user-mention">AlexandrDavydov</a>, <a href="https://github.com/indrek-koue" class="user-mention">indrek-koue</a>, <a href="https://github.com/QitmentX7" class="user-mention">QitmentX7</a>, <a href="https://github.com/esplemea" class="user-mention">esplemea</a>, <a href="https://github.com/FenixGit" class="user-mention">FenixGit</a>, <a href="https://github.com/AlexanderShniperson" class="user-mention">AlexanderShniperson</a>
and <a href="https://github.com/GijsGoudzwaard" class="user-mention">GijsGoudzwaard</a> for contributing.

+ 28
- 0
MobileApp/virtual-joystick-android-master/build.gradle View File

@@ -0,0 +1,28 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'

classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
google()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

+ 18
- 0
MobileApp/virtual-joystick-android-master/gradle.properties View File

@@ -0,0 +1,18 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

BIN
MobileApp/virtual-joystick-android-master/gradle/wrapper/gradle-wrapper.jar View File


+ 6
- 0
MobileApp/virtual-joystick-android-master/gradle/wrapper/gradle-wrapper.properties View File

@@ -0,0 +1,6 @@
#Tue Nov 20 17:17:49 EST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

+ 160
- 0
MobileApp/virtual-joystick-android-master/gradlew View File

@@ -0,0 +1,160 @@
#!/usr/bin/env bash

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
echo "$*"
}

die ( ) {
echo
echo "$*"
echo
exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option

if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

+ 90
- 0
MobileApp/virtual-joystick-android-master/gradlew.bat View File

@@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega

BIN
MobileApp/virtual-joystick-android-master/misc/android-virtual-joystick-custom-image.png View File


BIN
MobileApp/virtual-joystick-android-master/misc/virtual-joystick-android.png View File


BIN
MobileApp/virtual-joystick-android-master/misc/virtual-joystick.png View File


+ 1
- 0
MobileApp/virtual-joystick-android-master/settings.gradle View File

@@ -0,0 +1 @@
include ':virtualjoystick'

+ 1
- 0
MobileApp/virtual-joystick-android-master/virtualjoystick/.gitignore View File

@@ -0,0 +1 @@
/build

+ 47
- 0
MobileApp/virtual-joystick-android-master/virtualjoystick/build.gradle View File

@@ -0,0 +1,47 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 28

defaultConfig {
minSdkVersion 16
targetSdkVersion 32
versionCode 20
versionName "1.10.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
}

ext {
// Where you will see your artifact in Bintray's web interface
// The "bintrayName" should match the name of the Bintray repro.
bintrayRepo = 'maven'
bintrayName = 'virtual-joystick-android'

// Maven metadata
publishedGroupId = 'io.github.controlwear'
libraryName = 'virtual-joystick-android'
// Save yourself a head ache, and set this equal to the name of the Android Studio library
// module. The artifact name needs to match the name of the library.
artifact = 'virtualjoystick'

libraryDescription = 'This library provides a very simple and ready-to-use custom view which emulates a joystick for Android.'
libraryVersion = '1.10.1'

developerId = 'makowildcat'
developerName = 'Damien Brun'
developerEmail = 'makowildcat@gmail.com'
}

//apply from: 'https://raw.githubusercontent.com/attwellbrian/JCenter/master/installv1.gradle'
//apply from: 'https://raw.githubusercontent.com/attwellbrian/JCenter/master/bintrayv1.gradle'

+ 17
- 0
MobileApp/virtual-joystick-android-master/virtualjoystick/proguard-rules.pro View File

@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/damienbrun/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

+ 5
- 0
MobileApp/virtual-joystick-android-master/virtualjoystick/src/main/AndroidManifest.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
package="io.github.controlwear.virtual.joystick.android">

</manifest>

+ 871
- 0
MobileApp/virtual-joystick-android-master/virtualjoystick/src/main/java/io/github/controlwear/virtual/joystick/android/JoystickView.java View File

@@ -0,0 +1,871 @@
package io.github.controlwear.virtual.joystick.android;


import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;

public class JoystickView extends View
implements
Runnable {


/*
INTERFACES
*/


/**
* Interface definition for a callback to be invoked when a
* JoystickView's button is moved
*/
public interface OnMoveListener {

/**
* Called when a JoystickView's button has been moved
* @param angle current angle
* @param strength current strength
*/
void onMove(int angle, int strength);
}


/**
* Interface definition for a callback to be invoked when a JoystickView
* is touched and held by multiple pointers.
*/
public interface OnMultipleLongPressListener {
/**
* Called when a JoystickView has been touch and held enough time by multiple pointers.
*/
void onMultipleLongPress();
}


/*
CONSTANTS
*/

/**
* Default refresh rate as a time in milliseconds to send move values through callback
*/
private static final int DEFAULT_LOOP_INTERVAL = 50; // in milliseconds

/**
* Used to allow a slight move without cancelling MultipleLongPress
*/
private static final int MOVE_TOLERANCE = 10;

/**
* Default color for button
*/
private static final int DEFAULT_COLOR_BUTTON = Color.BLACK;

/**
* Default color for border
*/
private static final int DEFAULT_COLOR_BORDER = Color.TRANSPARENT;

/**
* Default alpha for border
*/
private static final int DEFAULT_ALPHA_BORDER = 255;

/**
* Default background color
*/
private static final int DEFAULT_BACKGROUND_COLOR = Color.TRANSPARENT;

/**
* Default View's size
*/
private static final int DEFAULT_SIZE = 200;

/**
* Default border's width
*/
private static final int DEFAULT_WIDTH_BORDER = 3;

/**
* Default behavior to fixed center (not auto-defined)
*/
private static final boolean DEFAULT_FIXED_CENTER = true;


/**
* Default behavior to auto re-center button (automatically recenter the button)
*/
private static final boolean DEFAULT_AUTO_RECENTER_BUTTON = true;


/**
* Default behavior to button stickToBorder (button stay on the border)
*/
private static final boolean DEFAULT_BUTTON_STICK_TO_BORDER = false;


// DRAWING
private Paint mPaintCircleButton;
private Paint mPaintCircleBorder;
private Paint mPaintBackground;

private Paint mPaintBitmapButton;
private Bitmap mButtonBitmap;


/**
* Ratio use to define the size of the button
*/
private float mButtonSizeRatio;


/**
* Ratio use to define the size of the background
*
*/
private float mBackgroundSizeRatio;


// COORDINATE
private int mPosX = 0;
private int mPosY = 0;
private int mCenterX = 0;
private int mCenterY = 0;

private int mFixedCenterX = 0;
private int mFixedCenterY = 0;

/**
* Used to adapt behavior whether it is auto-defined center (false) or fixed center (true)
*/
private boolean mFixedCenter;


/**
* Used to adapt behavior whether the button is automatically re-centered (true)
* when released or not (false)
*/
private boolean mAutoReCenterButton;


/**
* Used to adapt behavior whether the button is stick to border (true) or
* could be anywhere (when false - similar to regular behavior)
*/
private boolean mButtonStickToBorder;


/**
* Used to enabled/disabled the Joystick. When disabled (enabled to false) the joystick button
* can't move and onMove is not called.
*/
private boolean mEnabled;


// SIZE
private int mButtonRadius;
private int mBorderRadius;


/**
* Alpha of the border (to use when changing color dynamically)
*/
private int mBorderAlpha;


/**
* Based on mBorderRadius but a bit smaller (minus half the stroke size of the border)
*/
private float mBackgroundRadius;


/**
* Listener used to dispatch OnMove event
*/
private OnMoveListener mCallback;

private long mLoopInterval = DEFAULT_LOOP_INTERVAL;
private Thread mThread = new Thread(this);


/**
* Listener used to dispatch MultipleLongPress event
*/
private OnMultipleLongPressListener mOnMultipleLongPressListener;

private final Handler mHandlerMultipleLongPress = new Handler();
private Runnable mRunnableMultipleLongPress;
private int mMoveTolerance;


/**
* Default value.
* Both direction correspond to horizontal and vertical movement
*/
public static int BUTTON_DIRECTION_BOTH = 0;

/**
* The allowed direction of the button is define by the value of this parameter:
* - a negative value for horizontal axe
* - a positive value for vertical axe
* - zero for both axes
*/
private int mButtonDirection = 0;


/*
CONSTRUCTORS
*/


/**
* Simple constructor to use when creating a JoystickView from code.
* Call another constructor passing null to Attribute.
* @param context The Context the JoystickView is running in, through which it can
* access the current theme, resources, etc.
*/
public JoystickView(Context context) {
this(context, null);
}


public JoystickView(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs);
}


/**
* Constructor that is called when inflating a JoystickView from XML. This is called
* when a JoystickView is being constructed from an XML file, supplying attributes
* that were specified in the XML file.
* @param context The Context the JoystickView is running in, through which it can
* access the current theme, resources, etc.
* @param attrs The attributes of the XML tag that is inflating the JoystickView.
*/
public JoystickView(Context context, AttributeSet attrs) {
super(context, attrs);

TypedArray styledAttributes = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.JoystickView,
0, 0
);

int buttonColor;
int borderColor;
int backgroundColor;
int borderWidth;
Drawable buttonDrawable;
try {
buttonColor = styledAttributes.getColor(R.styleable.JoystickView_JV_buttonColor, DEFAULT_COLOR_BUTTON);
borderColor = styledAttributes.getColor(R.styleable.JoystickView_JV_borderColor, DEFAULT_COLOR_BORDER);
mBorderAlpha = styledAttributes.getInt(R.styleable.JoystickView_JV_borderAlpha, DEFAULT_ALPHA_BORDER);
backgroundColor = styledAttributes.getColor(R.styleable.JoystickView_JV_backgroundColor, DEFAULT_BACKGROUND_COLOR);
borderWidth = styledAttributes.getDimensionPixelSize(R.styleable.JoystickView_JV_borderWidth, DEFAULT_WIDTH_BORDER);
mFixedCenter = styledAttributes.getBoolean(R.styleable.JoystickView_JV_fixedCenter, DEFAULT_FIXED_CENTER);
mAutoReCenterButton = styledAttributes.getBoolean(R.styleable.JoystickView_JV_autoReCenterButton, DEFAULT_AUTO_RECENTER_BUTTON);
mButtonStickToBorder = styledAttributes.getBoolean(R.styleable.JoystickView_JV_buttonStickToBorder, DEFAULT_BUTTON_STICK_TO_BORDER);
buttonDrawable = styledAttributes.getDrawable(R.styleable.JoystickView_JV_buttonImage);
mEnabled = styledAttributes.getBoolean(R.styleable.JoystickView_JV_enabled, true);
mButtonSizeRatio = styledAttributes.getFraction(R.styleable.JoystickView_JV_buttonSizeRatio, 1, 1, 0.25f);
mBackgroundSizeRatio = styledAttributes.getFraction(R.styleable.JoystickView_JV_backgroundSizeRatio, 1, 1, 0.75f);
mButtonDirection = styledAttributes.getInteger(R.styleable.JoystickView_JV_buttonDirection, BUTTON_DIRECTION_BOTH);
} finally {
styledAttributes.recycle();
}

// Initialize the drawing according to attributes

mPaintCircleButton = new Paint();
mPaintCircleButton.setAntiAlias(true);
mPaintCircleButton.setColor(buttonColor);
mPaintCircleButton.setStyle(Paint.Style.FILL);

if (buttonDrawable != null) {
if (buttonDrawable instanceof BitmapDrawable) {
mButtonBitmap = ((BitmapDrawable) buttonDrawable).getBitmap();
mPaintBitmapButton = new Paint();
}
}

mPaintCircleBorder = new Paint();
mPaintCircleBorder.setAntiAlias(true);
mPaintCircleBorder.setColor(borderColor);
mPaintCircleBorder.setStyle(Paint.Style.STROKE);
mPaintCircleBorder.setStrokeWidth(borderWidth);

if (borderColor != Color.TRANSPARENT) {
mPaintCircleBorder.setAlpha(mBorderAlpha);
}

mPaintBackground = new Paint();
mPaintBackground.setAntiAlias(true);
mPaintBackground.setColor(backgroundColor);
mPaintBackground.setStyle(Paint.Style.FILL);


// Init Runnable for MultiLongPress

mRunnableMultipleLongPress = new Runnable() {
@Override
public void run() {
if (mOnMultipleLongPressListener != null)
mOnMultipleLongPressListener.onMultipleLongPress();
}
};
}


private void initPosition() {
// get the center of view to position circle
mFixedCenterX = mCenterX = mPosX = getWidth() / 2;
mFixedCenterY = mCenterY = mPosY = getWidth() / 2;
}


/**
* Draw the background, the border and the button
* @param canvas the canvas on which the shapes will be drawn
*/
@Override
protected void onDraw(Canvas canvas) {
// Draw the background
canvas.drawCircle(mFixedCenterX, mFixedCenterY, mBackgroundRadius, mPaintBackground);

// Draw the circle border
canvas.drawCircle(mFixedCenterX, mFixedCenterY, mBorderRadius, mPaintCircleBorder);

// Draw the button from image
if (mButtonBitmap != null) {
canvas.drawBitmap(
mButtonBitmap,
mPosX + mFixedCenterX - mCenterX - mButtonRadius,
mPosY + mFixedCenterY - mCenterY - mButtonRadius,
mPaintBitmapButton
);
}
// Draw the button as simple circle
else {
canvas.drawCircle(
mPosX + mFixedCenterX - mCenterX,
mPosY + mFixedCenterY - mCenterY,
mButtonRadius,
mPaintCircleButton
);
}
}


/**
* This is called during layout when the size of this view has changed.
* Here we get the center of the view and the radius to draw all the shapes.
*
* @param w Current width of this view.
* @param h Current height of this view.
* @param oldW Old width of this view.
* @param oldH Old height of this view.
*/
@Override
protected void onSizeChanged(int w, int h, int oldW, int oldH) {
super.onSizeChanged(w, h, oldW, oldH);

initPosition();

// radius based on smallest size : height OR width
int d = Math.min(w, h);
mButtonRadius = (int) (d / 2 * mButtonSizeRatio);
mBorderRadius = (int) (d / 2 * mBackgroundSizeRatio);
mBackgroundRadius = mBorderRadius - (mPaintCircleBorder.getStrokeWidth() / 2);

if (mButtonBitmap != null)
mButtonBitmap = Bitmap.createScaledBitmap(mButtonBitmap, mButtonRadius * 2, mButtonRadius * 2, true);
}


@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// setting the measured values to resize the view to a certain width and height
int d = Math.min(measure(widthMeasureSpec), measure(heightMeasureSpec));
setMeasuredDimension(d, d);
}


private int measure(int measureSpec) {
if (MeasureSpec.getMode(measureSpec) == MeasureSpec.UNSPECIFIED) {
// if no bounds are specified return a default size (200)
return DEFAULT_SIZE;
} else {
// As you want to fill the available space
// always return the full available bounds.
return MeasureSpec.getSize(measureSpec);
}
}


/*
USER EVENT
*/


/**
* Handle touch screen motion event. Move the button according to the
* finger coordinate and detect longPress by multiple pointers only.
*
* @param event The motion event.
* @return True if the event was handled, false otherwise.
*/
@Override
public boolean onTouchEvent(MotionEvent event) {
// if disabled we don't move the
if (!mEnabled) {
return true;
}


// to move the button according to the finger coordinate
// (or limited to one axe according to direction option
mPosY = mButtonDirection < 0 ? mCenterY : (int) event.getY(); // direction negative is horizontal axe
mPosX = mButtonDirection > 0 ? mCenterX : (int) event.getX(); // direction positive is vertical axe

if (event.getAction() == MotionEvent.ACTION_UP) {

// stop listener because the finger left the touch screen
mThread.interrupt();

// re-center the button or not (depending on settings)
if (mAutoReCenterButton) {
resetButtonPosition();

// update now the last strength and angle which should be zero after resetButton
if (mCallback != null)
mCallback.onMove(getAngle(), getStrength());
}

// if mAutoReCenterButton is false we will send the last strength and angle a bit
// later only after processing new position X and Y otherwise it could be above the border limit
}

if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (mThread != null && mThread.isAlive()) {
mThread.interrupt();
}

mThread = new Thread(this);
mThread.start();

if (mCallback != null)
mCallback.onMove(getAngle(), getStrength());
}

// handle first touch and long press with multiple touch only
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
// when the first touch occurs we update the center (if set to auto-defined center)
if (!mFixedCenter) {
mCenterX = mPosX;
mCenterY = mPosY;
}
break;

case MotionEvent.ACTION_POINTER_DOWN: {
// when the second finger touch
if (event.getPointerCount() == 2) {
mHandlerMultipleLongPress.postDelayed(mRunnableMultipleLongPress, ViewConfiguration.getLongPressTimeout()*2);
mMoveTolerance = MOVE_TOLERANCE;
}
break;
}

case MotionEvent.ACTION_MOVE:
mMoveTolerance--;
if (mMoveTolerance == 0) {
mHandlerMultipleLongPress.removeCallbacks(mRunnableMultipleLongPress);
}
break;

case MotionEvent.ACTION_POINTER_UP: {
// when the last multiple touch is released
if (event.getPointerCount() == 2) {
mHandlerMultipleLongPress.removeCallbacks(mRunnableMultipleLongPress);
}
break;
}
}

double abs = Math.sqrt((mPosX - mCenterX) * (mPosX - mCenterX)
+ (mPosY - mCenterY) * (mPosY - mCenterY));

// (abs > mBorderRadius) means button is too far therefore we limit to border
// (buttonStickBorder && abs != 0) means wherever is the button we stick it to the border except when abs == 0
if (abs > mBorderRadius || (mButtonStickToBorder && abs != 0)) {
mPosX = (int) ((mPosX - mCenterX) * mBorderRadius / abs + mCenterX);
mPosY = (int) ((mPosY - mCenterY) * mBorderRadius / abs + mCenterY);
}

if (!mAutoReCenterButton) {
// Now update the last strength and angle if not reset to center
if (mCallback != null)
mCallback.onMove(getAngle(), getStrength());
}


// to force a new draw
invalidate();

return true;
}


/*
GETTERS
*/


/**
* Process the angle following the 360° counter-clock protractor rules.
* @return the angle of the button
*/
private int getAngle() {
int angle = (int) Math.toDegrees(Math.atan2(mCenterY - mPosY, mPosX - mCenterX));
return angle < 0 ? angle + 360 : angle; // make it as a regular counter-clock protractor
}


/**
* Process the strength as a percentage of the distance between the center and the border.
* @return the strength of the button
*/
private int getStrength() {
return (int) (100 * Math.sqrt((mPosX - mCenterX)
* (mPosX - mCenterX) + (mPosY - mCenterY)
* (mPosY - mCenterY)) / mBorderRadius);
}


/**
* Reset the button position to the center.
*/
public void resetButtonPosition() {
mPosX = mCenterX;
mPosY = mCenterY;
}


/**
* Return the current direction allowed for the button to move
* @return Actually return an integer corresponding to the direction:
* - A negative value is horizontal axe,
* - A positive value is vertical axe,
* - Zero means both axes
*/
public int getButtonDirection() {
return mButtonDirection;
}


/**
* Return the state of the joystick. False when the button don't move.
* @return the state of the joystick
*/
public boolean isEnabled() {
return mEnabled;
}


/**
* Return the size of the button (as a ratio of the total width/height)
* Default is 0.25 (25%).
* @return button size (value between 0.0 and 1.0)
*/
public float getButtonSizeRatio() {
return mButtonSizeRatio;
}


/**
* Return the size of the background (as a ratio of the total width/height)
* Default is 0.75 (75%).
* @return background size (value between 0.0 and 1.0)
*/
public float getmBackgroundSizeRatio() {
return mBackgroundSizeRatio;
}


/**
* Return the current behavior of the auto re-center button
* @return True if automatically re-centered or False if not
*/
public boolean isAutoReCenterButton() {
return mAutoReCenterButton;
}


/**
* Return the current behavior of the button stick to border
* @return True if the button stick to the border otherwise False
*/
public boolean isButtonStickToBorder() {
return mButtonStickToBorder;
}


/**
* Return the relative X coordinate of button center related
* to top-left virtual corner of the border
* @return coordinate of X (normalized between 0 and 100)
*/
public int getNormalizedX() {
if (getWidth() == 0) {
return 50;
}
return Math.round((mPosX-mButtonRadius)*100.0f/(getWidth()-mButtonRadius*2));
}


/**
* Return the relative Y coordinate of the button center related
* to top-left virtual corner of the border
* @return coordinate of Y (normalized between 0 and 100)
*/
public int getNormalizedY() {
if (getHeight() == 0) {
return 50;
}
return Math.round((mPosY-mButtonRadius)*100.0f/(getHeight()-mButtonRadius*2));
}


/**
* Return the alpha of the border
* @return it should be an integer between 0 and 255 previously set
*/
public int getBorderAlpha() {
return mBorderAlpha;
}

/*
SETTERS
*/


/**
* Set an image to the button with a drawable
* @param d drawable to pick the image
*/
public void setButtonDrawable(Drawable d) {
if (d != null) {
if (d instanceof BitmapDrawable) {
mButtonBitmap = ((BitmapDrawable) d).getBitmap();

if (mButtonRadius != 0) {
mButtonBitmap = Bitmap.createScaledBitmap(
mButtonBitmap,
mButtonRadius * 2,
mButtonRadius * 2,
true);
}

if (mPaintBitmapButton != null)
mPaintBitmapButton = new Paint();
}
}
}


/**
* Set the button color for this JoystickView.
* @param color the color of the button
*/
public void setButtonColor(int color) {
mPaintCircleButton.setColor(color);
invalidate();
}


/**
* Set the border color for this JoystickView.
* @param color the color of the border
*/
public void setBorderColor(int color) {
mPaintCircleBorder.setColor(color);
if (color != Color.TRANSPARENT) {
mPaintCircleBorder.setAlpha(mBorderAlpha);
}
invalidate();
}


/**
* Set the border alpha for this JoystickView.
* @param alpha the transparency of the border between 0 and 255
*/
public void setBorderAlpha(int alpha) {
mBorderAlpha = alpha;
mPaintCircleBorder.setAlpha(alpha);
invalidate();
}


/**
* Set the background color for this JoystickView.
* @param color the color of the background
*/
@Override
public void setBackgroundColor(int color) {
mPaintBackground.setColor(color);
invalidate();
}


/**
* Set the border width for this JoystickView.
* @param width the width of the border
*/
public void setBorderWidth(int width) {
mPaintCircleBorder.setStrokeWidth(width);
mBackgroundRadius = mBorderRadius - (width / 2.0f);
invalidate();
}


/**
* Register a callback to be invoked when this JoystickView's button is moved
* @param l The callback that will run
*/
public void setOnMoveListener(OnMoveListener l) {
setOnMoveListener(l, DEFAULT_LOOP_INTERVAL);
}


/**
* Register a callback to be invoked when this JoystickView's button is moved
* @param l The callback that will run
* @param loopInterval Refresh rate to be invoked in milliseconds
*/
public void setOnMoveListener(OnMoveListener l, int loopInterval) {
mCallback = l;
mLoopInterval = loopInterval;
}


/**
* Register a callback to be invoked when this JoystickView is touch and held by multiple pointers
* @param l The callback that will run
*/
public void setOnMultiLongPressListener(OnMultipleLongPressListener l) {
mOnMultipleLongPressListener = l;
}


/**
* Set the joystick center's behavior (fixed or auto-defined)
* @param fixedCenter True for fixed center, False for auto-defined center based on touch down
*/
public void setFixedCenter(boolean fixedCenter) {
// if we set to "fixed" we make sure to re-init position related to the width of the joystick
if (fixedCenter) {
initPosition();
}
mFixedCenter = fixedCenter;
invalidate();
}


/**
* Enable or disable the joystick
* @param enabled False mean the button won't move and onMove won't be called
*/
public void setEnabled(boolean enabled) {
mEnabled = enabled;
}


/**
* Set the joystick button size (as a fraction of the real width/height)
* By default it is 25% (0.25).
* @param newRatio between 0.0 and 1.0
*/
public void setButtonSizeRatio(float newRatio) {
if (newRatio > 0.0f & newRatio <= 1.0f) {
mButtonSizeRatio = newRatio;
}
}


/**
* Set the joystick button size (as a fraction of the real width/height)
* By default it is 75% (0.75).
* Not working if the background is an image.
* @param newRatio between 0.0 and 1.0
*/
public void setBackgroundSizeRatio(float newRatio) {
if (newRatio > 0.0f & newRatio <= 1.0f) {
mBackgroundSizeRatio = newRatio;
}
}


/**
* Set the current behavior of the auto re-center button
* @param b True if automatically re-centered or False if not
*/
public void setAutoReCenterButton(boolean b) {
mAutoReCenterButton = b;
}


/**
* Set the current behavior of the button stick to border
* @param b True if the button stick to the border or False (default) if not
*/
public void setButtonStickToBorder(boolean b) {
mButtonStickToBorder = b;
}


/**
* Set the current authorized direction for the button to move
* @param direction the value will define the authorized direction:
* - any negative value (such as -1) for horizontal axe
* - any positive value (such as 1) for vertical axe
* - zero (0) for the full direction (both axes)
*/
public void setButtonDirection(int direction) {
mButtonDirection = direction;
}


/*
IMPLEMENTS
*/


@Override // Runnable
public void run() {
while (!Thread.interrupted()) {
post(new Runnable() {
public void run() {
if (mCallback != null)
mCallback.onMove(getAngle(), getStrength());
}
});

try {
Thread.sleep(mLoopInterval);
} catch (InterruptedException e) {
break;
}
}
}
}

+ 40
- 0
MobileApp/virtual-joystick-android-master/virtualjoystick/src/main/res/values/attrs.xml View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>


<declare-styleable name="JoystickView">

<attr name="JV_buttonImage" format="reference" />

<attr name="JV_buttonColor" format="color"/>

<attr name="JV_borderColor" format="color"/>

<attr name="JV_borderAlpha" format="integer"/>

<attr name="JV_backgroundColor" format="color"/>

<attr name="JV_borderWidth" format="dimension"/>

<attr name="JV_fixedCenter" format="boolean"/>

<attr name="JV_autoReCenterButton" format="boolean"/>

<attr name="JV_buttonStickToBorder" format="boolean"/>

<attr name="JV_enabled" format="boolean"/>

<attr name="JV_buttonSizeRatio" format="fraction"/>

<attr name="JV_backgroundSizeRatio" format="fraction"/>

<attr name="JV_buttonDirection">
<flag name="horizontal" value="-1"/>
<flag name="both" value="0"/>
<flag name="vertical" value="1"/>

</attr>

</declare-styleable>

</resources>

+ 15
- 0
MobileApp/virtual-joystick-android-master/virtualjoystick/src/test/java/io/github/controlwear/virtual/joystick/android/ExampleUnitTest.java View File

@@ -0,0 +1,15 @@
package io.github.controlwear.virtual.joystick.android;

import org.junit.Test;

import static org.junit.Assert.*;

/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}

Loading…
Cancel
Save