├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── net │ │ └── redlinesoft │ │ └── androidrobotbtjoystick │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ │ └── net │ │ │ └── redlinesoft │ │ │ └── androidrobotbtjoystick │ │ │ ├── AppCompatPreferenceActivity.java │ │ │ ├── MainActivity.java │ │ │ └── SettingsActivity.java │ └── res │ │ ├── drawable-hdpi │ │ ├── ic_action_gear.png │ │ ├── ic_bluetooth.png │ │ ├── ic_fullscreen.png │ │ ├── ic_game.png │ │ ├── ic_info_black_24dp.png │ │ ├── ic_notifications_black_24dp.png │ │ ├── ic_setting.png │ │ └── ic_sync_black_24dp.png │ │ ├── drawable-ldpi │ │ ├── bg_stick_right.xml │ │ ├── bg_stick_unpressed_right.xml │ │ ├── ic_action_gear.png │ │ ├── ic_bluetooth.png │ │ ├── ic_game.png │ │ └── ic_setting.png │ │ ├── drawable-mdpi │ │ ├── ic_action_gear.png │ │ ├── ic_bluetooth.png │ │ ├── ic_fullscreen.png │ │ ├── ic_game.png │ │ ├── ic_info_black_24dp.png │ │ ├── ic_notifications_black_24dp.png │ │ ├── ic_setting.png │ │ └── ic_sync_black_24dp.png │ │ ├── drawable-tvdpi │ │ ├── ic_action_gear.png │ │ ├── ic_bluetooth.png │ │ ├── ic_game.png │ │ └── ic_setting.png │ │ ├── drawable-v21 │ │ ├── ic_info_black_24dp.xml │ │ ├── ic_notifications_black_24dp.xml │ │ └── ic_sync_black_24dp.xml │ │ ├── drawable-xhdpi │ │ ├── ic_action_gear.png │ │ ├── ic_bluetooth.png │ │ ├── ic_fullscreen.png │ │ ├── ic_game.png │ │ ├── ic_info_black_24dp.png │ │ ├── ic_notifications_black_24dp.png │ │ ├── ic_setting.png │ │ └── ic_sync_black_24dp.png │ │ ├── drawable-xxhdpi │ │ ├── ic_action_gear.png │ │ ├── ic_bluetooth.png │ │ ├── ic_fullscreen.png │ │ ├── ic_game.png │ │ ├── ic_info_black_24dp.png │ │ ├── ic_notifications_black_24dp.png │ │ ├── ic_setting.png │ │ └── ic_sync_black_24dp.png │ │ ├── drawable-xxxhdpi │ │ ├── ic_action_gear.png │ │ ├── ic_bluetooth.png │ │ ├── ic_game.png │ │ ├── ic_info_black_24dp.png │ │ ├── ic_notifications_black_24dp.png │ │ ├── ic_setting.png │ │ └── ic_sync_black_24dp.png │ │ ├── drawable │ │ ├── bg_base.xml │ │ ├── bg_stick.xml │ │ ├── bg_stick_pressed.xml │ │ ├── bg_stick_pressed_right.xml │ │ └── bg_stick_unpressed.xml │ │ ├── layout-land │ │ └── activity_main.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── menu │ │ └── main_menu.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ ├── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ ├── pref_general.xml │ │ ├── pref_headers.xml │ │ ├── pref_joystick_left.xml │ │ └── pref_joystick_right.xml │ └── test │ └── java │ └── net │ └── redlinesoft │ └── androidrobotbtjoystick │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | Android Robot BT Joystick -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #Android Bluetooth Joystick 2 | 3 | ##Feature 4 | 5 | * Dual Joystick (left & right). 6 | * Config buttons for left and right joystick support 16 commands. 7 | * Config buttons forHold stick mode (Press and hold left or right joystick) support 16 commands. 8 | * Support motion constrain for horizontal or vertical. 9 | * Support video streaming from robot camera to mobile, joystick overlay on the video. 10 | 11 | ##Screenshot 12 | 13 | ![](https://lh3.googleusercontent.com/-rea1EQdAw9c/VlMAv97tpPI/AAAAAAAAV-0/a5o7Hs9S1pU/s640-Ic42/DFG_2015-11-23-17-30-58.png) 14 | 15 | ![](https://lh3.googleusercontent.com/-vn-EGT90qI8/VlMAW6o9VlI/AAAAAAAAV-k/op1B506TYq4/s640-Ic42/DFG_2015-11-23-18-17-54.png) 16 | 17 | ![](https://lh3.googleusercontent.com/-CAgsHaf_w38/VlMAWEgk53I/AAAAAAAAV-g/wSX8009nm2Y/s640-Ic42/DFG_2015-11-23-18-18-05.png) 18 | 19 | ![](https://lh3.googleusercontent.com/-_mdG1BwqEl0/VlMAob0gu4I/AAAAAAAAV-s/llG5J7mynr4/s640-Ic42/DFG_2015-11-23-18-18-15.png) 20 | 21 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "net.redlinesoft.androidrobotbtjoystick" 9 | minSdkVersion 15 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.1.0' 26 | compile 'com.jmedeisis:bugstick:0.2.2' 27 | compile 'com.akexorcist:bluetoothspp:1.0.0' 28 | 29 | } 30 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/anuchit/Downloads/android-sdk-macosx/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/net/redlinesoft/androidrobotbtjoystick/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package net.redlinesoft.androidrobotbtjoystick; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 22 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/java/net/redlinesoft/androidrobotbtjoystick/AppCompatPreferenceActivity.java: -------------------------------------------------------------------------------- 1 | package net.redlinesoft.androidrobotbtjoystick; 2 | 3 | import android.content.res.Configuration; 4 | import android.os.Bundle; 5 | import android.preference.PreferenceActivity; 6 | import android.support.annotation.LayoutRes; 7 | import android.support.annotation.Nullable; 8 | import android.support.v7.app.ActionBar; 9 | import android.support.v7.app.AppCompatDelegate; 10 | import android.support.v7.widget.Toolbar; 11 | import android.view.MenuInflater; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | 15 | /** 16 | * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls 17 | * to be used with AppCompat. 18 | */ 19 | public abstract class AppCompatPreferenceActivity extends PreferenceActivity { 20 | 21 | private AppCompatDelegate mDelegate; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | getDelegate().installViewFactory(); 26 | getDelegate().onCreate(savedInstanceState); 27 | super.onCreate(savedInstanceState); 28 | } 29 | 30 | @Override 31 | protected void onPostCreate(Bundle savedInstanceState) { 32 | super.onPostCreate(savedInstanceState); 33 | getDelegate().onPostCreate(savedInstanceState); 34 | } 35 | 36 | public ActionBar getSupportActionBar() { 37 | return getDelegate().getSupportActionBar(); 38 | } 39 | 40 | public void setSupportActionBar(@Nullable Toolbar toolbar) { 41 | getDelegate().setSupportActionBar(toolbar); 42 | } 43 | 44 | @Override 45 | public MenuInflater getMenuInflater() { 46 | return getDelegate().getMenuInflater(); 47 | } 48 | 49 | @Override 50 | public void setContentView(@LayoutRes int layoutResID) { 51 | getDelegate().setContentView(layoutResID); 52 | } 53 | 54 | @Override 55 | public void setContentView(View view) { 56 | getDelegate().setContentView(view); 57 | } 58 | 59 | @Override 60 | public void setContentView(View view, ViewGroup.LayoutParams params) { 61 | getDelegate().setContentView(view, params); 62 | } 63 | 64 | @Override 65 | public void addContentView(View view, ViewGroup.LayoutParams params) { 66 | getDelegate().addContentView(view, params); 67 | } 68 | 69 | @Override 70 | protected void onPostResume() { 71 | super.onPostResume(); 72 | getDelegate().onPostResume(); 73 | } 74 | 75 | @Override 76 | protected void onTitleChanged(CharSequence title, int color) { 77 | super.onTitleChanged(title, color); 78 | getDelegate().setTitle(title); 79 | } 80 | 81 | @Override 82 | public void onConfigurationChanged(Configuration newConfig) { 83 | super.onConfigurationChanged(newConfig); 84 | getDelegate().onConfigurationChanged(newConfig); 85 | } 86 | 87 | @Override 88 | protected void onStop() { 89 | super.onStop(); 90 | getDelegate().onStop(); 91 | } 92 | 93 | @Override 94 | protected void onDestroy() { 95 | super.onDestroy(); 96 | getDelegate().onDestroy(); 97 | } 98 | 99 | public void invalidateOptionsMenu() { 100 | getDelegate().invalidateOptionsMenu(); 101 | } 102 | 103 | private AppCompatDelegate getDelegate() { 104 | if (mDelegate == null) { 105 | mDelegate = AppCompatDelegate.create(this, null); 106 | } 107 | return mDelegate; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /app/src/main/java/net/redlinesoft/androidrobotbtjoystick/MainActivity.java: -------------------------------------------------------------------------------- 1 | package net.redlinesoft.androidrobotbtjoystick; 2 | 3 | import android.app.Activity; 4 | import android.app.AlertDialog; 5 | import android.bluetooth.BluetoothAdapter; 6 | import android.content.Context; 7 | import android.content.DialogInterface; 8 | import android.content.Intent; 9 | import android.content.SharedPreferences; 10 | import android.graphics.Color; 11 | import android.net.Uri; 12 | import android.os.Build; 13 | import android.os.Bundle; 14 | import android.os.Handler; 15 | import android.preference.PreferenceManager; 16 | import android.support.v7.app.AppCompatActivity; 17 | import android.util.Log; 18 | import android.view.Menu; 19 | import android.view.MenuItem; 20 | import android.view.View; 21 | import android.widget.TextView; 22 | import android.widget.Toast; 23 | import android.widget.VideoView; 24 | 25 | import com.jmedeisis.bugstick.Joystick; 26 | import com.jmedeisis.bugstick.JoystickListener; 27 | 28 | import java.util.Map; 29 | import java.util.Timer; 30 | import java.util.TimerTask; 31 | 32 | import app.akexorcist.bluetotohspp.library.BluetoothSPP; 33 | import app.akexorcist.bluetotohspp.library.BluetoothState; 34 | import app.akexorcist.bluetotohspp.library.DeviceList; 35 | 36 | public class MainActivity extends AppCompatActivity { 37 | 38 | private static final int STICK_NONE = 0; 39 | private static final int STICK_UP = 1; 40 | private static final int STICK_UPRIGHT = 2; 41 | private static final int STICK_RIGHT = 3; 42 | private static final int STICK_DOWNRIGHT = 4; 43 | private static final int STICK_DOWN = 5; 44 | private static final int STICK_DOWNLEFT = 6; 45 | private static final int STICK_LEFT = 7; 46 | private static final int STICK_UPLEFT = 8; 47 | private static final int RESULT_SETTING = 0; 48 | 49 | private View mDecorView; 50 | Boolean buttonDownLeft = false; 51 | Boolean buttonDownRight = false; 52 | BluetoothSPP bt; 53 | Context context; 54 | Boolean btConnect = false; 55 | 56 | TextView txtAngle; 57 | TextView txtOffset; 58 | TextView txtHold; 59 | TextView txtValue; 60 | Menu menu; 61 | Joystick joystickRight, joystickLeft; 62 | SharedPreferences prefs; 63 | VideoView videoView; 64 | 65 | @Override 66 | protected void onCreate(Bundle savedInstanceState) { 67 | super.onCreate(savedInstanceState); 68 | setContentView(R.layout.activity_main); 69 | 70 | prefs = PreferenceManager.getDefaultSharedPreferences(this); 71 | 72 | getWindow().getDecorView().setBackgroundColor(getResources().getColor(R.color.windowBackground)); 73 | 74 | joystickLeft = (Joystick) findViewById(R.id.joystickLeft); 75 | joystickRight = (Joystick) findViewById(R.id.joystickRight); 76 | 77 | 78 | // setup bluetooth 79 | bt = new BluetoothSPP(context); 80 | checkBluetoothState(); 81 | 82 | bt.setBluetoothConnectionListener(new BluetoothSPP.BluetoothConnectionListener() { 83 | public void onDeviceConnected(String name, String address) { 84 | // Do something when successfully connected 85 | Toast.makeText(getApplicationContext(), R.string.state_connected, Toast.LENGTH_SHORT).show(); 86 | btConnect = true; 87 | // change setting menu 88 | MenuItem settingsItem = menu.findItem(R.id.mnuBluetooth); 89 | settingsItem.setTitle(R.string.mnu_disconnect); 90 | } 91 | 92 | public void onDeviceDisconnected() { 93 | // Do something when connection was disconnected 94 | Toast.makeText(getApplicationContext(), R.string.state_disconnected, Toast.LENGTH_SHORT).show(); 95 | btConnect = false; 96 | btConnect = true; 97 | // change setting menu 98 | MenuItem settingsItem = menu.findItem(R.id.mnuBluetooth); 99 | settingsItem.setTitle(R.string.mnu_connect); 100 | } 101 | 102 | public void onDeviceConnectionFailed() { 103 | // Do something when connection failed 104 | Toast.makeText(getApplicationContext(), R.string.state_connection_failed, Toast.LENGTH_SHORT).show(); 105 | btConnect = false; 106 | // change setting menu 107 | MenuItem settingsItem = menu.findItem(R.id.mnuBluetooth); 108 | settingsItem.setTitle(R.string.mnu_connect); 109 | } 110 | }); 111 | 112 | // set view 113 | mDecorView = getWindow().getDecorView(); 114 | hideSystemUI(); 115 | } 116 | 117 | 118 | private String joystickData(String key, float offset) { 119 | final boolean pwm = prefs.getBoolean("pref_send_pwm_switch", false); 120 | String data = ""; 121 | if ((pwm == false) && (distanceConvert(offset) >= 100)) { 122 | // start 123 | if (prefs.getBoolean("pref_token_switch", true) == true) { 124 | data = data + prefs.getString("pref_before_token", ""); 125 | } 126 | // data 127 | data = data + prefs.getString(key, ""); 128 | // pwm 129 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 130 | data = data + prefs.getString("pref_pwm_separator", ""); 131 | data = data + distanceConvert(offset); 132 | } 133 | // stop 134 | if (prefs.getBoolean("pref_token_switch", true) == true) { 135 | data = data + prefs.getString("pref_end_token", ""); 136 | } 137 | } else if (pwm == true) { 138 | // start 139 | if (prefs.getBoolean("pref_token_switch", true) == true) { 140 | data = data + prefs.getString("pref_before_token", ""); 141 | } 142 | // data 143 | data = data + prefs.getString(key, ""); 144 | // pwm 145 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 146 | data = data + prefs.getString("pref_pwm_separator", ""); 147 | data = data + distanceConvert(offset); 148 | } 149 | // stop 150 | if (prefs.getBoolean("pref_token_switch", true) == true) { 151 | data = data + prefs.getString("pref_end_token", ""); 152 | } 153 | } 154 | return data; 155 | } 156 | 157 | private void setup() { 158 | // set view 159 | txtAngle = (TextView) findViewById(R.id.txtAngle); 160 | txtOffset = (TextView) findViewById(R.id.txtOffset); 161 | txtHold = (TextView) findViewById(R.id.txtHold); 162 | txtValue = (TextView) findViewById(R.id.txtValue); 163 | 164 | // setup motion constrain for joystick right 165 | joystickLeft.setJoystickListener(new JoystickListener() { 166 | @Override 167 | public void onDown() { 168 | buttonDownLeft = true; 169 | } 170 | 171 | @Override 172 | public void onDrag(float degrees, float offset) { 173 | // set text 174 | txtAngle.setText(String.valueOf(angleConvert(degrees))); 175 | txtOffset.setText(String.valueOf(distanceConvert(offset))); 176 | 177 | // check position 178 | int direction = get8Direction(degrees); 179 | 180 | // Right hold 181 | if ((buttonDownRight) && (prefs.getBoolean("pref_hold_right",false)==true)) { 182 | // set text 183 | txtHold.setText("Right Hold"); 184 | // action left joystick 185 | if (direction == STICK_UP) { 186 | /*String data = ""; 187 | // start 188 | if (prefs.getBoolean("pref_token_switch", true) == true) { 189 | data = data + prefs.getString("pref_before_token", ""); 190 | } 191 | // data 192 | data = data + prefs.getString("pref_hold_left_pos_up", ""); 193 | // pwm 194 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 195 | data = data + prefs.getString("pref_pwm_separator", ""); 196 | data = data + distanceConvert(offset); 197 | } 198 | // stop 199 | if (prefs.getBoolean("pref_token_switch", true) == true) { 200 | data = data + prefs.getString("pref_end_token", ""); 201 | }*/ 202 | String data = joystickData("pref_hold_left_pos_up", offset); 203 | sendBluetoothData(data); 204 | } else if (direction == STICK_UPRIGHT) { 205 | /*String data = ""; 206 | // start 207 | if (prefs.getBoolean("pref_token_switch", true) == true) { 208 | data = data + prefs.getString("pref_before_token", ""); 209 | } 210 | // data 211 | data = data + prefs.getString("pref_hold_left_pos_upright", ""); 212 | // pwm 213 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 214 | data = data + prefs.getString("pref_pwm_separator", ""); 215 | data = data + distanceConvert(offset); 216 | } 217 | // stop 218 | if (prefs.getBoolean("pref_token_switch", true) == true) { 219 | data = data + prefs.getString("pref_end_token", ""); 220 | }*/ 221 | String data = joystickData("pref_hold_left_pos_upright", offset); 222 | sendBluetoothData(data); 223 | } else if (direction == STICK_RIGHT) { 224 | /*String data = ""; 225 | // start 226 | if (prefs.getBoolean("pref_token_switch", true) == true) { 227 | data = data + prefs.getString("pref_before_token", ""); 228 | } 229 | // data 230 | data = data + prefs.getString("pref_hold_left_pos_right", ""); 231 | // pwm 232 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 233 | data = data + prefs.getString("pref_pwm_separator", ""); 234 | data = data + distanceConvert(offset); 235 | } 236 | // stop 237 | if (prefs.getBoolean("pref_token_switch", true) == true) { 238 | data = data + prefs.getString("pref_end_token", ""); 239 | }*/ 240 | String data = joystickData("pref_hold_left_pos_right", offset); 241 | sendBluetoothData(data); 242 | } else if (direction == STICK_DOWNRIGHT) { 243 | /*String data = ""; 244 | // start 245 | if (prefs.getBoolean("pref_token_switch", true) == true) { 246 | data = data + prefs.getString("pref_before_token", ""); 247 | } 248 | // data 249 | data = data + prefs.getString("pref_hold_left_pos_downright", ""); 250 | // pwm 251 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 252 | data = data + prefs.getString("pref_pwm_separator", ""); 253 | data = data + distanceConvert(offset); 254 | } 255 | // stop 256 | if (prefs.getBoolean("pref_token_switch", true) == true) { 257 | data = data + prefs.getString("pref_end_token", ""); 258 | }*/ 259 | String data = joystickData("pref_hold_left_pos_downright", offset); 260 | sendBluetoothData(data); 261 | } else if (direction == STICK_DOWN) { 262 | /*String data = ""; 263 | // start 264 | if (prefs.getBoolean("pref_token_switch", true) == true) { 265 | data = data + prefs.getString("pref_before_token", ""); 266 | } 267 | // data 268 | data = data + prefs.getString("pref_hold_left_pos_down", ""); 269 | // pwm 270 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 271 | data = data + prefs.getString("pref_pwm_separator", ""); 272 | data = data + distanceConvert(offset); 273 | } 274 | // stop 275 | if (prefs.getBoolean("pref_token_switch", true) == true) { 276 | data = data + prefs.getString("pref_end_token", ""); 277 | }*/ 278 | String data = joystickData("pref_hold_left_pos_down", offset); 279 | sendBluetoothData(data); 280 | } else if (direction == STICK_DOWNLEFT) { 281 | /*String data = ""; 282 | // start 283 | if (prefs.getBoolean("pref_token_switch", true) == true) { 284 | data = data + prefs.getString("pref_before_token", ""); 285 | } 286 | // data 287 | data = data + prefs.getString("pref_hold_left_pos_downleft", ""); 288 | // pwm 289 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 290 | data = data + prefs.getString("pref_pwm_separator", ""); 291 | data = data + distanceConvert(offset); 292 | } 293 | // stop 294 | if (prefs.getBoolean("pref_token_switch", true) == true) { 295 | data = data + prefs.getString("pref_end_token", ""); 296 | }*/ 297 | String data = joystickData("pref_hold_left_pos_downleft", offset); 298 | sendBluetoothData(data); 299 | } else if (direction == STICK_LEFT) { 300 | /*String data = ""; 301 | // start 302 | if (prefs.getBoolean("pref_token_switch", true) == true) { 303 | data = data + prefs.getString("pref_before_token", ""); 304 | } 305 | // data 306 | data = data + prefs.getString("pref_hold_left_pos_left", ""); 307 | // pwm 308 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 309 | data = data + prefs.getString("pref_pwm_separator", ""); 310 | data = data + distanceConvert(offset); 311 | } 312 | // stop 313 | if (prefs.getBoolean("pref_token_switch", true) == true) { 314 | data = data + prefs.getString("pref_end_token", ""); 315 | }*/ 316 | String data = joystickData("pref_hold_left_pos_left", offset); 317 | sendBluetoothData(data); 318 | } else if (direction == STICK_UPLEFT) { 319 | /*String data = ""; 320 | // start 321 | if (prefs.getBoolean("pref_token_switch", true) == true) { 322 | data = data + prefs.getString("pref_before_token", ""); 323 | } 324 | // data 325 | data = data + prefs.getString("pref_hold_left_pos_upleft", ""); 326 | // pwm 327 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 328 | data = data + prefs.getString("pref_pwm_separator", ""); 329 | data = data + distanceConvert(offset); 330 | } 331 | // stop 332 | if (prefs.getBoolean("pref_token_switch", true) == true) { 333 | data = data + prefs.getString("pref_end_token", ""); 334 | }*/ 335 | String data = joystickData("pref_hold_left_pos_upleft", offset); 336 | sendBluetoothData(data); 337 | } else { 338 | // no direction 339 | } 340 | } else { 341 | // action left joystick 342 | if (direction == STICK_UP) { 343 | /*String data = ""; 344 | // start 345 | if (prefs.getBoolean("pref_token_switch", true) == true) { 346 | data = data + prefs.getString("pref_before_token", ""); 347 | } 348 | // data 349 | data = data + prefs.getString("pref_left_pos_up", ""); 350 | // pwm 351 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 352 | data = data + prefs.getString("pref_pwm_separator", ""); 353 | data = data + distanceConvert(offset); 354 | } 355 | // stop 356 | if (prefs.getBoolean("pref_token_switch", true) == true) { 357 | data = data + prefs.getString("pref_end_token", ""); 358 | }*/ 359 | String data = joystickData("pref_left_pos_up", offset); 360 | sendBluetoothData(data); 361 | } else if (direction == STICK_UPRIGHT) { 362 | /*String data = ""; 363 | // start 364 | if (prefs.getBoolean("pref_token_switch", true) == true) { 365 | data = data + prefs.getString("pref_before_token", ""); 366 | } 367 | // data 368 | data = data + prefs.getString("pref_left_pos_upright", ""); 369 | // pwm 370 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 371 | data = data + prefs.getString("pref_pwm_separator", ""); 372 | data = data + distanceConvert(offset); 373 | } 374 | // stop 375 | if (prefs.getBoolean("pref_token_switch", true) == true) { 376 | data = data + prefs.getString("pref_end_token", ""); 377 | }*/ 378 | String data = joystickData("pref_left_pos_upright", offset); 379 | sendBluetoothData(data); 380 | } else if (direction == STICK_RIGHT) { 381 | /*String data = ""; 382 | // start 383 | if (prefs.getBoolean("pref_token_switch", true) == true) { 384 | data = data + prefs.getString("pref_before_token", ""); 385 | } 386 | // data 387 | data = data + prefs.getString("pref_left_pos_right", ""); 388 | // pwm 389 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 390 | data = data + prefs.getString("pref_pwm_separator", ""); 391 | data = data + distanceConvert(offset); 392 | } 393 | // stop 394 | if (prefs.getBoolean("pref_token_switch", true) == true) { 395 | data = data + prefs.getString("pref_end_token", ""); 396 | }*/ 397 | String data = joystickData("pref_left_pos_right", offset); 398 | sendBluetoothData(data); 399 | } else if (direction == STICK_DOWNRIGHT) { 400 | /*String data = ""; 401 | // start 402 | if (prefs.getBoolean("pref_token_switch", true) == true) { 403 | data = data + prefs.getString("pref_before_token", ""); 404 | } 405 | // data 406 | data = data + prefs.getString("pref_left_pos_downright", ""); 407 | // pwm 408 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 409 | data = data + prefs.getString("pref_pwm_separator", ""); 410 | data = data + distanceConvert(offset); 411 | } 412 | // stop 413 | if (prefs.getBoolean("pref_token_switch", true) == true) { 414 | data = data + prefs.getString("pref_end_token", ""); 415 | }*/ 416 | String data = joystickData("pref_left_pos_downright", offset); 417 | sendBluetoothData(data); 418 | } else if (direction == STICK_DOWN) { 419 | /*String data = ""; 420 | // start 421 | if (prefs.getBoolean("pref_token_switch", true) == true) { 422 | data = data + prefs.getString("pref_before_token", ""); 423 | } 424 | // data 425 | data = data + prefs.getString("pref_left_pos_down", ""); 426 | // pwm 427 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 428 | data = data + prefs.getString("pref_pwm_separator", ""); 429 | data = data + distanceConvert(offset); 430 | } 431 | // stop 432 | if (prefs.getBoolean("pref_token_switch", true) == true) { 433 | data = data + prefs.getString("pref_end_token", ""); 434 | }*/ 435 | String data = joystickData("pref_left_pos_down", offset); 436 | sendBluetoothData(data); 437 | } else if (direction == STICK_DOWNLEFT) { 438 | /*String data = ""; 439 | // start 440 | if (prefs.getBoolean("pref_token_switch", true) == true) { 441 | data = data + prefs.getString("pref_before_token", ""); 442 | } 443 | // data 444 | data = data + prefs.getString("pref_left_pos_downleft", ""); 445 | // pwm 446 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 447 | data = data + prefs.getString("pref_pwm_separator", ""); 448 | data = data + distanceConvert(offset); 449 | } 450 | // stop 451 | if (prefs.getBoolean("pref_token_switch", true) == true) { 452 | data = data + prefs.getString("pref_end_token", ""); 453 | }*/ 454 | String data = joystickData("pref_left_pos_downleft", offset); 455 | sendBluetoothData(data); 456 | } else if (direction == STICK_LEFT) { 457 | /*String data = ""; 458 | // start 459 | if (prefs.getBoolean("pref_token_switch", true) == true) { 460 | data = data + prefs.getString("pref_before_token", ""); 461 | } 462 | // data 463 | data = data + prefs.getString("pref_left_pos_left", ""); 464 | // pwm 465 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 466 | data = data + prefs.getString("pref_pwm_separator", ""); 467 | data = data + distanceConvert(offset); 468 | } 469 | // stop 470 | if (prefs.getBoolean("pref_token_switch", true) == true) { 471 | data = data + prefs.getString("pref_end_token", ""); 472 | }*/ 473 | String data = joystickData("pref_left_pos_left", offset); 474 | sendBluetoothData(data); 475 | } else if (direction == STICK_UPLEFT) { 476 | /*String data = ""; 477 | // start 478 | if (prefs.getBoolean("pref_token_switch", true) == true) { 479 | data = data + prefs.getString("pref_before_token", ""); 480 | } 481 | // data 482 | data = data + prefs.getString("pref_left_pos_upleft", ""); 483 | // pwm 484 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 485 | data = data + prefs.getString("pref_pwm_separator", ""); 486 | data = data + distanceConvert(offset); 487 | } 488 | // stop 489 | if (prefs.getBoolean("pref_token_switch", true) == true) { 490 | data = data + prefs.getString("pref_end_token", ""); 491 | }*/ 492 | String data = joystickData("pref_left_pos_upleft", offset); 493 | sendBluetoothData(data); 494 | } else { 495 | // no direction 496 | } 497 | } 498 | } 499 | 500 | @Override 501 | public void onUp() { 502 | // set text 503 | txtAngle.setText(""); 504 | txtOffset.setText(""); 505 | txtHold.setText(""); 506 | buttonDownLeft = false; 507 | //String data = joystickData("pref_left_pos_none", 0); 508 | //sendBluetoothData(data); 509 | } 510 | }); 511 | 512 | joystickRight.setJoystickListener(new JoystickListener() { 513 | @Override 514 | public void onDown() { 515 | buttonDownRight = true; 516 | } 517 | 518 | @Override 519 | public void onDrag(float degrees, float offset) { 520 | // set text 521 | txtAngle.setText(String.valueOf(angleConvert(degrees))); 522 | txtOffset.setText(String.valueOf(distanceConvert(offset))); 523 | 524 | // check position 525 | int direction = get8Direction(degrees); 526 | 527 | // Left hold 528 | if ((buttonDownLeft) && (prefs.getBoolean("pref_hold_left",false)==true)) { 529 | // set text 530 | txtHold.setText("Left Hold"); 531 | // action 532 | if (direction == STICK_UP) { 533 | /*String data = ""; 534 | // start 535 | if (prefs.getBoolean("pref_token_switch", true) == true) { 536 | data = data + prefs.getString("pref_before_token", ""); 537 | } 538 | // data 539 | data = data + prefs.getString("pref_hold_right_pos_up", ""); 540 | // pwm 541 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 542 | data = data + prefs.getString("pref_pwm_separator", ""); 543 | data = data + distanceConvert(offset); 544 | } 545 | // stop 546 | if (prefs.getBoolean("pref_token_switch", true) == true) { 547 | data = data + prefs.getString("pref_end_token", ""); 548 | }*/ 549 | String data = joystickData("pref_hold_right_pos_up", offset); 550 | sendBluetoothData(data); 551 | } else if (direction == STICK_UPRIGHT) { 552 | /*String data = ""; 553 | // start 554 | if (prefs.getBoolean("pref_token_switch", true) == true) { 555 | data = data + prefs.getString("pref_before_token", ""); 556 | } 557 | // data 558 | data = data + prefs.getString("pref_hold_right_pos_upright", ""); 559 | // pwm 560 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 561 | data = data + prefs.getString("pref_pwm_separator", ""); 562 | data = data + distanceConvert(offset); 563 | } 564 | // stop 565 | if (prefs.getBoolean("pref_token_switch", true) == true) { 566 | data = data + prefs.getString("pref_end_token", ""); 567 | }*/ 568 | String data = joystickData("pref_hold_right_pos_upright", offset); 569 | sendBluetoothData(data); 570 | } else if (direction == STICK_RIGHT) { 571 | /*String data = ""; 572 | // start 573 | if (prefs.getBoolean("pref_token_switch", true) == true) { 574 | data = data + prefs.getString("pref_before_token", ""); 575 | } 576 | // data 577 | data = data + prefs.getString("pref_hold_right_pos_right", ""); 578 | // pwm 579 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 580 | data = data + prefs.getString("pref_pwm_separator", ""); 581 | data = data + distanceConvert(offset); 582 | } 583 | // stop 584 | if (prefs.getBoolean("pref_token_switch", true) == true) { 585 | data = data + prefs.getString("pref_end_token", ""); 586 | }*/ 587 | String data = joystickData("pref_hold_right_pos_right", offset); 588 | sendBluetoothData(data); 589 | } else if (direction == STICK_DOWNRIGHT) { 590 | /*String data = ""; 591 | // start 592 | if (prefs.getBoolean("pref_token_switch", true) == true) { 593 | data = data + prefs.getString("pref_before_token", ""); 594 | } 595 | // data 596 | data = data + prefs.getString("pref_hold_right_pos_downright", ""); 597 | // pwm 598 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 599 | data = data + prefs.getString("pref_pwm_separator", ""); 600 | data = data + distanceConvert(offset); 601 | } 602 | // stop 603 | if (prefs.getBoolean("pref_token_switch", true) == true) { 604 | data = data + prefs.getString("pref_end_token", ""); 605 | }*/ 606 | String data = joystickData("pref_hold_right_pos_downright", offset); 607 | sendBluetoothData(data); 608 | } else if (direction == STICK_DOWN) { 609 | /*String data = ""; 610 | // start 611 | if (prefs.getBoolean("pref_token_switch", true) == true) { 612 | data = data + prefs.getString("pref_before_token", ""); 613 | } 614 | // data 615 | data = data + prefs.getString("pref_hold_right_pos_down", ""); 616 | // pwm 617 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 618 | data = data + prefs.getString("pref_pwm_separator", ""); 619 | data = data + distanceConvert(offset); 620 | } 621 | // stop 622 | if (prefs.getBoolean("pref_token_switch", true) == true) { 623 | data = data + prefs.getString("pref_end_token", ""); 624 | }*/ 625 | String data = joystickData("pref_hold_right_pos_down", offset); 626 | sendBluetoothData(data); 627 | } else if (direction == STICK_DOWNLEFT) { 628 | /*String data = ""; 629 | // start 630 | if (prefs.getBoolean("pref_token_switch", true) == true) { 631 | data = data + prefs.getString("pref_before_token", ""); 632 | } 633 | // data 634 | data = data + prefs.getString("pref_hold_right_pos_downleft", ""); 635 | // pwm 636 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 637 | data = data + prefs.getString("pref_pwm_separator", ""); 638 | data = data + distanceConvert(offset); 639 | } 640 | // stop 641 | if (prefs.getBoolean("pref_token_switch", true) == true) { 642 | data = data + prefs.getString("pref_end_token", ""); 643 | }*/ 644 | String data = joystickData("pref_hold_right_pos_downleft", offset); 645 | sendBluetoothData(data); 646 | } else if (direction == STICK_LEFT) { 647 | /*String data = ""; 648 | // start 649 | if (prefs.getBoolean("pref_token_switch", true) == true) { 650 | data = data + prefs.getString("pref_before_token", ""); 651 | } 652 | // data 653 | data = data + prefs.getString("pref_hold_right_pos_left", ""); 654 | // pwm 655 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 656 | data = data + prefs.getString("pref_pwm_separator", ""); 657 | data = data + distanceConvert(offset); 658 | } 659 | // stop 660 | if (prefs.getBoolean("pref_token_switch", true) == true) { 661 | data = data + prefs.getString("pref_end_token", ""); 662 | }*/ 663 | String data = joystickData("pref_hold_right_pos_left", offset); 664 | sendBluetoothData(data); 665 | } else if (direction == STICK_UPLEFT) { 666 | /*String data = ""; 667 | // start 668 | if (prefs.getBoolean("pref_token_switch", true) == true) { 669 | data = data + prefs.getString("pref_before_token", ""); 670 | } 671 | // data 672 | data = data + prefs.getString("pref_hold_right_pos_upleft", ""); 673 | // pwm 674 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 675 | data = data + prefs.getString("pref_pwm_separator", ""); 676 | data = data + distanceConvert(offset); 677 | } 678 | // stop 679 | if (prefs.getBoolean("pref_token_switch", true) == true) { 680 | data = data + prefs.getString("pref_end_token", ""); 681 | }*/ 682 | String data = joystickData("pref_hold_right_pos_upleft", offset); 683 | sendBluetoothData(data); 684 | } else { 685 | // no direction 686 | } 687 | } else { 688 | // Not hold 689 | // set action 690 | if (direction == STICK_UP) { 691 | /*String data = ""; 692 | // start 693 | if (prefs.getBoolean("pref_token_switch", true) == true) { 694 | data = data + prefs.getString("pref_before_token", ""); 695 | } 696 | // data 697 | data = data + prefs.getString("pref_right_pos_up", ""); 698 | // pwm 699 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 700 | data = data + prefs.getString("pref_pwm_separator", ""); 701 | data = data + distanceConvert(offset); 702 | } 703 | // stop 704 | if (prefs.getBoolean("pref_token_switch", true) == true) { 705 | data = data + prefs.getString("pref_end_token", ""); 706 | }*/ 707 | String data = joystickData("pref_right_pos_up", offset); 708 | sendBluetoothData(data); 709 | } else if (direction == STICK_UPRIGHT) { 710 | /*String data = ""; 711 | // start 712 | if (prefs.getBoolean("pref_token_switch", true) == true) { 713 | data = data + prefs.getString("pref_before_token", ""); 714 | } 715 | // data 716 | data = data + prefs.getString("pref_right_pos_upright", ""); 717 | // pwm 718 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 719 | data = data + prefs.getString("pref_pwm_separator", ""); 720 | data = data + distanceConvert(offset); 721 | } 722 | // stop 723 | if (prefs.getBoolean("pref_token_switch", true) == true) { 724 | data = data + prefs.getString("pref_end_token", ""); 725 | }*/ 726 | String data = joystickData("pref_right_pos_upright", offset); 727 | sendBluetoothData(data); 728 | } else if (direction == STICK_RIGHT) { 729 | /*String data = ""; 730 | // start 731 | if (prefs.getBoolean("pref_token_switch", true) == true) { 732 | data = data + prefs.getString("pref_before_token", ""); 733 | } 734 | // data 735 | data = data + prefs.getString("pref_right_pos_right", ""); 736 | // pwm 737 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 738 | data = data + prefs.getString("pref_pwm_separator", ""); 739 | data = data + distanceConvert(offset); 740 | } 741 | // stop 742 | if (prefs.getBoolean("pref_token_switch", true) == true) { 743 | data = data + prefs.getString("pref_end_token", ""); 744 | }*/ 745 | String data = joystickData("pref_right_pos_right", offset); 746 | sendBluetoothData(data); 747 | } else if (direction == STICK_DOWNRIGHT) { 748 | /*String data = ""; 749 | // start 750 | if (prefs.getBoolean("pref_token_switch", true) == true) { 751 | data = data + prefs.getString("pref_before_token", ""); 752 | } 753 | // data 754 | data = data + prefs.getString("pref_right_pos_downright", ""); 755 | // pwm 756 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 757 | data = data + prefs.getString("pref_pwm_separator", ""); 758 | data = data + distanceConvert(offset); 759 | } 760 | // stop 761 | if (prefs.getBoolean("pref_token_switch", true) == true) { 762 | data = data + prefs.getString("pref_end_token", ""); 763 | }*/ 764 | String data = joystickData("pref_right_pos_downright", offset); 765 | sendBluetoothData(data); 766 | } else if (direction == STICK_DOWN) { 767 | /*String data = ""; 768 | // start 769 | if (prefs.getBoolean("pref_token_switch", true) == true) { 770 | data = data + prefs.getString("pref_before_token", ""); 771 | } 772 | // data 773 | data = data + prefs.getString("pref_right_pos_down", ""); 774 | // pwm 775 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 776 | data = data + prefs.getString("pref_pwm_separator", ""); 777 | data = data + distanceConvert(offset); 778 | } 779 | // stop 780 | if (prefs.getBoolean("pref_token_switch", true) == true) { 781 | data = data + prefs.getString("pref_end_token", ""); 782 | }*/ 783 | String data = joystickData("pref_right_pos_down", offset); 784 | sendBluetoothData(data); 785 | } else if (direction == STICK_DOWNLEFT) { 786 | /*String data = ""; 787 | // start 788 | if (prefs.getBoolean("pref_token_switch", true) == true) { 789 | data = data + prefs.getString("pref_before_token", ""); 790 | } 791 | // data 792 | data = data + prefs.getString("pref_right_pos_downleft", ""); 793 | // pwm 794 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 795 | data = data + prefs.getString("pref_pwm_separator", ""); 796 | data = data + distanceConvert(offset); 797 | } 798 | // stop 799 | if (prefs.getBoolean("pref_token_switch", true) == true) { 800 | data = data + prefs.getString("pref_end_token", ""); 801 | }*/ 802 | String data = joystickData("pref_right_pos_downleft", offset); 803 | sendBluetoothData(data); 804 | } else if (direction == STICK_LEFT) { 805 | /*String data = ""; 806 | // start 807 | if (prefs.getBoolean("pref_token_switch", true) == true) { 808 | data = data + prefs.getString("pref_before_token", ""); 809 | } 810 | // data 811 | data = data + prefs.getString("pref_right_pos_left", ""); 812 | // pwm 813 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 814 | data = data + prefs.getString("pref_pwm_separator", ""); 815 | data = data + distanceConvert(offset); 816 | } 817 | // stop 818 | if (prefs.getBoolean("pref_token_switch", true) == true) { 819 | data = data + prefs.getString("pref_end_token", ""); 820 | }*/ 821 | String data = joystickData("pref_right_pos_left", offset); 822 | sendBluetoothData(data); 823 | } else if (direction == STICK_UPLEFT) { 824 | /*String data = ""; 825 | // start 826 | if (prefs.getBoolean("pref_token_switch", true) == true) { 827 | data = data + prefs.getString("pref_before_token", ""); 828 | } 829 | // data 830 | data = data + prefs.getString("pref_right_pos_upleft", ""); 831 | // pwm 832 | if (prefs.getBoolean("pref_send_pwm_switch", true) == true) { 833 | data = data + prefs.getString("pref_pwm_separator", ""); 834 | data = data + distanceConvert(offset); 835 | } 836 | // stop 837 | if (prefs.getBoolean("pref_token_switch", true) == true) { 838 | data = data + prefs.getString("pref_end_token", ""); 839 | }*/ 840 | String data = joystickData("pref_right_pos_upleft", offset); 841 | sendBluetoothData(data); 842 | } else { 843 | // no direction 844 | } 845 | } 846 | 847 | } 848 | 849 | @Override 850 | public void onUp() { 851 | txtAngle.setText(""); 852 | txtOffset.setText(""); 853 | txtHold.setText(""); 854 | buttonDownRight = false; 855 | //String data = joystickData("pref_right_pos_none", 0); 856 | //sendBluetoothData(data); 857 | } 858 | }); 859 | } 860 | 861 | private void checkBluetoothState() { 862 | if (bt.isBluetoothEnabled()) { 863 | if (this.btConnect == true) { 864 | bt.disconnect(); 865 | } 866 | bt.setupService(); 867 | bt.startService(BluetoothState.DEVICE_OTHER); 868 | // load device list 869 | Intent intent = new Intent(getApplicationContext(), DeviceList.class); 870 | startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE); 871 | } 872 | } 873 | 874 | private void setupJoystickMode() { 875 | 876 | if (prefs.getBoolean("pref_left_switch",true)==false){ 877 | joystickLeft.setVisibility(View.INVISIBLE); 878 | }else { 879 | joystickLeft.setVisibility(View.VISIBLE); 880 | } 881 | 882 | if (prefs.getBoolean("pref_right_switch",true)==false){ 883 | joystickRight.setVisibility(View.INVISIBLE); 884 | }else { 885 | joystickRight.setVisibility(View.VISIBLE); 886 | } 887 | 888 | // setup motion constrain for joystick left 889 | if (prefs.getBoolean("pref_constrain_left_switch", false) == false) { 890 | Log.d("LOG-JOY", "constrain normal"); 891 | joystickLeft.setMotionConstraint(Joystick.MotionConstraint.NONE); 892 | } else if (((prefs.getBoolean("pref_constrain_left_hor", true)) == true) && ((prefs.getBoolean("pref_constrain_left_ver", true)) == false)) { 893 | Log.d("LOG-JOY", "constrain hor"); 894 | joystickLeft.setMotionConstraint(Joystick.MotionConstraint.HORIZONTAL); 895 | } else if (((prefs.getBoolean("pref_constrain_left_hor", true)) == false) && ((prefs.getBoolean("pref_constrain_left_ver", true)) == true)) { 896 | Log.d("LOG-JOY", "constrain ver"); 897 | joystickLeft.setMotionConstraint(Joystick.MotionConstraint.VERTICAL); 898 | } else { 899 | joystickLeft.setMotionConstraint(Joystick.MotionConstraint.NONE); 900 | } 901 | 902 | // setup motion constrain for joystick right 903 | if (prefs.getBoolean("pref_constrain_right_switch", false) == false) { 904 | Log.d("LOG-JOY", "constrain normal"); 905 | joystickRight.setMotionConstraint(Joystick.MotionConstraint.NONE); 906 | } else if (((prefs.getBoolean("pref_constrain_right_hor", true)) == true) && 907 | ((prefs.getBoolean("pref_constrain_right_ver", true)) == false)) { 908 | Log.d("LOG-JOY", "constrain hor"); 909 | joystickRight.setMotionConstraint(Joystick.MotionConstraint.HORIZONTAL); 910 | } else if (((prefs.getBoolean("pref_constrain_right_hor", true)) == false) && 911 | ((prefs.getBoolean("pref_constrain_right_ver", true)) == true)) { 912 | Log.d("LOG-JOY", "constrain ver"); 913 | joystickRight.setMotionConstraint(Joystick.MotionConstraint.VERTICAL); 914 | } else { 915 | joystickRight.setMotionConstraint(Joystick.MotionConstraint.NONE); 916 | } 917 | } 918 | 919 | private void setupVideoMode() { 920 | // setup motion constrain for joystick left 921 | if (prefs.getBoolean("pref_send_video_switch", false) == true) { 922 | // start video 923 | try { 924 | videoView = (VideoView) findViewById(R.id.videoView); 925 | videoView.setVisibility(View.VISIBLE); 926 | Uri videoUri = Uri.parse(prefs.getString("pref_video", "")); 927 | videoView.setVideoURI(videoUri); 928 | videoView.start(); 929 | } catch (Exception e) { 930 | Log.d("LOG", e.getMessage()); 931 | } 932 | } else { 933 | videoView = (VideoView) findViewById(R.id.videoView); 934 | videoView.setVisibility(View.INVISIBLE); 935 | } 936 | } 937 | 938 | @Override 939 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 940 | //super.onActivityResult(requestCode, resultCode, data); 941 | if (requestCode == BluetoothState.REQUEST_CONNECT_DEVICE) { 942 | if (resultCode == Activity.RESULT_OK) 943 | bt.connect(data); 944 | setup(); 945 | } else if (requestCode == BluetoothState.REQUEST_ENABLE_BT) { 946 | if (resultCode == Activity.RESULT_OK) { 947 | bt.setupService(); 948 | bt.startService(BluetoothState.DEVICE_OTHER); 949 | setup(); 950 | } else { 951 | // Do something if user doesn't choose any device (Pressed back) 952 | } 953 | } 954 | } 955 | 956 | @Override 957 | protected void onStart() { 958 | super.onStart(); 959 | // setup bluetooth 960 | if (!bt.isBluetoothEnabled()) { 961 | Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); 962 | startActivityForResult(enableBtIntent, BluetoothState.REQUEST_ENABLE_BT); 963 | } 964 | // setup joystick mode after restart 965 | setupJoystickMode(); 966 | // setup video camera 967 | setupVideoMode(); 968 | } 969 | 970 | 971 | @Override 972 | protected void onDestroy() { 973 | super.onDestroy(); 974 | bt.stopService(); 975 | } 976 | 977 | @Override 978 | protected void onResume() { 979 | super.onResume(); 980 | 981 | } 982 | 983 | @Override 984 | protected void onRestart() { 985 | super.onRestart(); 986 | loadPreference(); 987 | } 988 | 989 | public void loadPreference() { 990 | prefs = PreferenceManager.getDefaultSharedPreferences(this); 991 | Map keys = prefs.getAll(); 992 | Log.d("LOG", "Keys = " + keys.size() + ""); 993 | if (keys.size() > 8) { 994 | for (Map.Entry entry : keys.entrySet()) { 995 | Log.d("LOG", entry.getKey() + ": " + 996 | entry.getValue().toString()); 997 | } 998 | } else { 999 | AlertDialog.Builder builder = new AlertDialog.Builder(this); 1000 | builder.setTitle(R.string.alert_nodata_setup_first); 1001 | builder.setCancelable(false); 1002 | builder.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() { 1003 | public void onClick(DialogInterface dialog, int id) { 1004 | // User clicked OK button 1005 | Intent i = new Intent(getApplicationContext(), SettingsActivity.class); 1006 | startActivityForResult(i, RESULT_SETTING); 1007 | } 1008 | }); 1009 | builder.show(); 1010 | } 1011 | } 1012 | 1013 | 1014 | public void sendBluetoothData(final String data) { 1015 | // FIXME: 11/23/15 flood output T_T 1016 | final int delay = Integer.parseInt(prefs.getString("pref_delay_list", "1000")); 1017 | 1018 | final Handler handler = new Handler(); 1019 | 1020 | final Runnable r = new Runnable() { 1021 | public void run() { 1022 | Log.d("LOG", data); 1023 | txtValue.setText(data); 1024 | bt.send(data, true); 1025 | } 1026 | }; 1027 | handler.postDelayed(r, delay); 1028 | } 1029 | 1030 | public int get8Direction(float degrees) { 1031 | float angle = angleConvert(degrees); 1032 | 1033 | if (angle >= 85 && angle < 95) { 1034 | return STICK_UP; 1035 | } else if (angle >= 40 && angle < 50) { 1036 | return STICK_UPRIGHT; 1037 | } else if (angle >= 355 || angle < 5) { 1038 | return STICK_RIGHT; 1039 | } else if (angle >= 310 && angle < 320) { 1040 | return STICK_DOWNRIGHT; 1041 | } else if (angle >= 265 && angle < 275) { 1042 | return STICK_DOWN; 1043 | } else if (angle >= 220 && angle < 230) { 1044 | return STICK_DOWNLEFT; 1045 | } else if (angle >= 175 && angle < 185) { 1046 | return STICK_LEFT; 1047 | } else if (angle >= 130 && angle < 140) { 1048 | return STICK_UPLEFT; 1049 | } 1050 | 1051 | return 0; 1052 | } 1053 | 1054 | public int angleConvert(float degrees) { 1055 | int angle = 0; 1056 | if ((int) degrees < 0) angle = (360 + (int) degrees); 1057 | else angle = (int) degrees; 1058 | return angle; 1059 | } 1060 | 1061 | public int distanceConvert(float offset) { 1062 | int pwm = (int) (offset * 100); 1063 | return (pwm); 1064 | } 1065 | 1066 | @Override 1067 | public boolean onCreateOptionsMenu(Menu menu) { 1068 | getMenuInflater().inflate(R.menu.main_menu, menu); 1069 | this.menu = menu; 1070 | return super.onCreateOptionsMenu(menu); 1071 | } 1072 | 1073 | @Override 1074 | public boolean onOptionsItemSelected(MenuItem item) { 1075 | int itemId = item.getItemId(); 1076 | 1077 | if (itemId == R.id.mnuBluetooth) { 1078 | checkBluetoothState(); 1079 | } else if (itemId == R.id.mnuSetting) { 1080 | Intent i = new Intent(getApplicationContext(), SettingsActivity.class); 1081 | startActivityForResult(i, RESULT_SETTING); 1082 | } else if (itemId ==R.id.mnuFullscreen) { 1083 | hideSystemUI(); 1084 | } 1085 | 1086 | return super.onOptionsItemSelected(item); 1087 | } 1088 | 1089 | @Override 1090 | public void onWindowFocusChanged(boolean hasFocus) { 1091 | if (hasFocus) 1092 | hideSystemUI(); 1093 | } 1094 | 1095 | // This snippet hides the system bars. 1096 | private void hideSystemUI() { 1097 | // Set the IMMERSIVE flag. 1098 | // Set the content to appear under the system bars so that the content 1099 | // doesn't resize when the system bars hide and show. 1100 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { 1101 | mDecorView.setSystemUiVisibility( 1102 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE 1103 | | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 1104 | | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 1105 | | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar 1106 | | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar 1107 | | View.SYSTEM_UI_FLAG_IMMERSIVE 1108 | ); 1109 | } 1110 | } 1111 | 1112 | // This snippet shows the system bars. It does this by removing all the flags 1113 | // except for the ones that make the content appear under the system bars. 1114 | private void showSystemUI() { 1115 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { 1116 | mDecorView.setSystemUiVisibility( 1117 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE 1118 | | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 1119 | | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); 1120 | } 1121 | } 1122 | 1123 | 1124 | } 1125 | -------------------------------------------------------------------------------- /app/src/main/java/net/redlinesoft/androidrobotbtjoystick/SettingsActivity.java: -------------------------------------------------------------------------------- 1 | package net.redlinesoft.androidrobotbtjoystick; 2 | 3 | 4 | import android.annotation.TargetApi; 5 | import android.content.Context; 6 | import android.content.res.Configuration; 7 | import android.os.Build; 8 | import android.os.Bundle; 9 | import android.preference.ListPreference; 10 | import android.preference.Preference; 11 | import android.preference.PreferenceActivity; 12 | import android.preference.PreferenceFragment; 13 | import android.preference.PreferenceManager; 14 | import android.support.v7.app.ActionBar; 15 | import android.view.MenuItem; 16 | 17 | import java.util.List; 18 | 19 | /** 20 | * A {@link PreferenceActivity} that presents a set of application settings. On 21 | * handset devices, settings are presented as a single list. On tablets, 22 | * settings are split by category, with category headers shown to the left of 23 | * the list of settings. 24 | *

25 | * See 26 | * Android Design: Settings for design guidelines and the Settings 28 | * API Guide for more information on developing a Settings UI. 29 | */ 30 | public class SettingsActivity extends AppCompatPreferenceActivity { 31 | /** 32 | * A preference value change listener that updates the preference's summary 33 | * to reflect its new value. 34 | */ 35 | private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() { 36 | @Override 37 | public boolean onPreferenceChange(Preference preference, Object value) { 38 | String stringValue = value.toString(); 39 | 40 | 41 | if (preference instanceof ListPreference) { 42 | // For list preferences, look up the correct display value in 43 | // the preference's 'entries' list. 44 | ListPreference listPreference = (ListPreference) preference; 45 | int index = listPreference.findIndexOfValue(stringValue); 46 | 47 | // Set the summary to reflect the new value. 48 | preference.setSummary( 49 | index >= 0 50 | ? listPreference.getEntries()[index] 51 | : null); 52 | 53 | } else { 54 | // For all other preferences, set the summary to the value's 55 | // simple string representation. 56 | preference.setSummary(stringValue); 57 | } 58 | 59 | return true; 60 | } 61 | }; 62 | 63 | 64 | /** 65 | * Helper method to determine if the device has an extra-large screen. For 66 | * example, 10" tablets are extra-large. 67 | */ 68 | private static boolean isXLargeTablet(Context context) { 69 | return (context.getResources().getConfiguration().screenLayout 70 | & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE; 71 | } 72 | 73 | /** 74 | * Binds a preference's summary to its value. More specifically, when the 75 | * preference's value is changed, its summary (line of text below the 76 | * preference title) is updated to reflect the value. The summary is also 77 | * immediately updated upon calling this method. The exact display format is 78 | * dependent on the type of preference. 79 | * 80 | * @see #sBindPreferenceSummaryToValueListener 81 | */ 82 | private static void bindPreferenceSummaryToValue(Preference preference) { 83 | // Set the listener to watch for value changes. 84 | preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener); 85 | 86 | // Trigger the listener immediately with the preference's 87 | // current value. 88 | sBindPreferenceSummaryToValueListener.onPreferenceChange(preference, 89 | PreferenceManager 90 | .getDefaultSharedPreferences(preference.getContext()) 91 | .getString(preference.getKey(), "")); 92 | } 93 | 94 | @Override 95 | protected void onCreate(Bundle savedInstanceState) { 96 | super.onCreate(savedInstanceState); 97 | setupActionBar(); 98 | } 99 | 100 | /** 101 | * Set up the {@link android.app.ActionBar}, if the API is available. 102 | */ 103 | private void setupActionBar() { 104 | ActionBar actionBar = getSupportActionBar(); 105 | if (actionBar != null) { 106 | // Show the Up button in the action bar. 107 | actionBar.setDisplayHomeAsUpEnabled(true); 108 | } 109 | } 110 | 111 | /** 112 | * {@inheritDoc} 113 | */ 114 | @Override 115 | public boolean onIsMultiPane() { 116 | return isXLargeTablet(this); 117 | } 118 | 119 | /** 120 | * {@inheritDoc} 121 | */ 122 | @Override 123 | @TargetApi(Build.VERSION_CODES.HONEYCOMB) 124 | public void onBuildHeaders(List

target) { 125 | loadHeadersFromResource(R.xml.pref_headers, target); 126 | } 127 | 128 | /** 129 | * This method stops fragment injection in malicious applications. 130 | * Make sure to deny any unknown fragments here. 131 | */ 132 | protected boolean isValidFragment(String fragmentName) { 133 | return PreferenceFragment.class.getName().equals(fragmentName) 134 | || GeneralPreferenceFragment.class.getName().equals(fragmentName) 135 | || JoystickLeftPreferenceFragment.class.getName().equals(fragmentName) 136 | || JoystickRightPreferenceFragment.class.getName().equals(fragmentName); 137 | } 138 | 139 | /** 140 | * This fragment shows general preferences only. It is used when the 141 | * activity is showing a two-pane settings UI. 142 | */ 143 | @TargetApi(Build.VERSION_CODES.HONEYCOMB) 144 | public static class GeneralPreferenceFragment extends PreferenceFragment { 145 | @Override 146 | public void onCreate(Bundle savedInstanceState) { 147 | super.onCreate(savedInstanceState); 148 | addPreferencesFromResource(R.xml.pref_general); 149 | setHasOptionsMenu(true); 150 | 151 | // Bind the summaries of EditText/List/Dialog preferences 152 | // to their values. When their values change, their summaries are 153 | // updated to reflect the new value, per the Android Design 154 | // guidelines. 155 | bindPreferenceSummaryToValue(findPreference("pref_before_token")); 156 | bindPreferenceSummaryToValue(findPreference("pref_end_token")); 157 | bindPreferenceSummaryToValue(findPreference("pref_pwm_separator")); 158 | bindPreferenceSummaryToValue(findPreference("pref_video")); 159 | // bindPreferenceSummaryToValue(findPreference("pref_pwm_angle_separator")); 160 | bindPreferenceSummaryToValue(findPreference("pref_delay_list")); 161 | } 162 | 163 | @Override 164 | public boolean onOptionsItemSelected(MenuItem item) { 165 | int id = item.getItemId(); 166 | if (id == android.R.id.home) { 167 | //startActivity(new Intent(getActivity(), SettingsActivity.class)); 168 | return true; 169 | } 170 | return super.onOptionsItemSelected(item); 171 | } 172 | } 173 | 174 | /** 175 | * This fragment shows notification preferences only. It is used when the 176 | * activity is showing a two-pane settings UI. 177 | */ 178 | @TargetApi(Build.VERSION_CODES.HONEYCOMB) 179 | public static class JoystickLeftPreferenceFragment extends PreferenceFragment { 180 | @Override 181 | public void onCreate(Bundle savedInstanceState) { 182 | super.onCreate(savedInstanceState); 183 | addPreferencesFromResource(R.xml.pref_joystick_left); 184 | setHasOptionsMenu(true); 185 | 186 | // Bind the summaries of EditText/List/Dialog preferences 187 | // to their values. When their values change, their summaries are 188 | // updated to reflect the new value, per the Android Design 189 | // guidelines. 190 | //bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone")); 191 | bindPreferenceSummaryToValue(findPreference("pref_left_pos_up")); 192 | bindPreferenceSummaryToValue(findPreference("pref_left_pos_down")); 193 | bindPreferenceSummaryToValue(findPreference("pref_left_pos_left")); 194 | bindPreferenceSummaryToValue(findPreference("pref_left_pos_right")); 195 | bindPreferenceSummaryToValue(findPreference("pref_left_pos_upleft")); 196 | bindPreferenceSummaryToValue(findPreference("pref_left_pos_upright")); 197 | bindPreferenceSummaryToValue(findPreference("pref_left_pos_downleft")); 198 | bindPreferenceSummaryToValue(findPreference("pref_left_pos_downright")); 199 | bindPreferenceSummaryToValue(findPreference("pref_hold_left_pos_up")); 200 | bindPreferenceSummaryToValue(findPreference("pref_hold_left_pos_down")); 201 | bindPreferenceSummaryToValue(findPreference("pref_hold_left_pos_left")); 202 | bindPreferenceSummaryToValue(findPreference("pref_hold_left_pos_right")); 203 | bindPreferenceSummaryToValue(findPreference("pref_hold_left_pos_upleft")); 204 | bindPreferenceSummaryToValue(findPreference("pref_hold_left_pos_upright")); 205 | bindPreferenceSummaryToValue(findPreference("pref_hold_left_pos_downleft")); 206 | bindPreferenceSummaryToValue(findPreference("pref_hold_left_pos_downright")); 207 | bindPreferenceSummaryToValue(findPreference("pref_left_pos_none")); 208 | } 209 | 210 | @Override 211 | public boolean onOptionsItemSelected(MenuItem item) { 212 | int id = item.getItemId(); 213 | if (id == android.R.id.home) { 214 | //startActivity(new Intent(getActivity(), SettingsActivity.class)); 215 | return true; 216 | } 217 | return super.onOptionsItemSelected(item); 218 | } 219 | } 220 | 221 | /** 222 | * This fragment shows data and sync preferences only. It is used when the 223 | * activity is showing a two-pane settings UI. 224 | */ 225 | @TargetApi(Build.VERSION_CODES.HONEYCOMB) 226 | public static class JoystickRightPreferenceFragment extends PreferenceFragment { 227 | @Override 228 | public void onCreate(Bundle savedInstanceState) { 229 | super.onCreate(savedInstanceState); 230 | addPreferencesFromResource(R.xml.pref_joystick_right); 231 | setHasOptionsMenu(true); 232 | 233 | // Bind the summaries of EditText/List/Dialog preferences 234 | // to their values. When their values change, their summaries are 235 | // updated to reflect the new value, per the Android Design 236 | // guidelines. 237 | bindPreferenceSummaryToValue(findPreference("pref_right_pos_up")); 238 | bindPreferenceSummaryToValue(findPreference("pref_right_pos_down")); 239 | bindPreferenceSummaryToValue(findPreference("pref_right_pos_left")); 240 | bindPreferenceSummaryToValue(findPreference("pref_right_pos_right")); 241 | bindPreferenceSummaryToValue(findPreference("pref_right_pos_upleft")); 242 | bindPreferenceSummaryToValue(findPreference("pref_right_pos_upright")); 243 | bindPreferenceSummaryToValue(findPreference("pref_right_pos_downleft")); 244 | bindPreferenceSummaryToValue(findPreference("pref_right_pos_downright")); 245 | bindPreferenceSummaryToValue(findPreference("pref_hold_right_pos_up")); 246 | bindPreferenceSummaryToValue(findPreference("pref_hold_right_pos_down")); 247 | bindPreferenceSummaryToValue(findPreference("pref_hold_right_pos_left")); 248 | bindPreferenceSummaryToValue(findPreference("pref_hold_right_pos_right")); 249 | bindPreferenceSummaryToValue(findPreference("pref_hold_right_pos_upleft")); 250 | bindPreferenceSummaryToValue(findPreference("pref_hold_right_pos_upright")); 251 | bindPreferenceSummaryToValue(findPreference("pref_hold_right_pos_downleft")); 252 | bindPreferenceSummaryToValue(findPreference("pref_hold_right_pos_downright")); 253 | bindPreferenceSummaryToValue(findPreference("pref_right_pos_none")); 254 | } 255 | 256 | @Override 257 | public boolean onOptionsItemSelected(MenuItem item) { 258 | int id = item.getItemId(); 259 | if (id == android.R.id.home) { 260 | //startActivity(new Intent(getActivity(), SettingsActivity.class)); 261 | return true; 262 | } 263 | return super.onOptionsItemSelected(item); 264 | } 265 | } 266 | } 267 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-hdpi/ic_action_gear.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_bluetooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-hdpi/ic_bluetooth.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_fullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-hdpi/ic_fullscreen.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-hdpi/ic_game.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_info_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-hdpi/ic_info_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_notifications_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-hdpi/ic_notifications_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-hdpi/ic_setting.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_sync_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-hdpi/ic_sync_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/bg_stick_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/bg_stick_unpressed_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/ic_action_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-ldpi/ic_action_gear.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/ic_bluetooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-ldpi/ic_bluetooth.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/ic_game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-ldpi/ic_game.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/ic_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-ldpi/ic_setting.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-mdpi/ic_action_gear.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_bluetooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-mdpi/ic_bluetooth.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_fullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-mdpi/ic_fullscreen.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-mdpi/ic_game.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_info_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-mdpi/ic_info_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_notifications_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-mdpi/ic_notifications_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-mdpi/ic_setting.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_sync_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-mdpi/ic_sync_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-tvdpi/ic_action_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-tvdpi/ic_action_gear.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-tvdpi/ic_bluetooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-tvdpi/ic_bluetooth.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-tvdpi/ic_game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-tvdpi/ic_game.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-tvdpi/ic_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-tvdpi/ic_setting.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_info_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_notifications_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_sync_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xhdpi/ic_action_gear.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_bluetooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xhdpi/ic_bluetooth.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_fullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xhdpi/ic_fullscreen.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xhdpi/ic_game.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_info_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xhdpi/ic_info_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_notifications_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xhdpi/ic_notifications_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xhdpi/ic_setting.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxhdpi/ic_action_gear.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_bluetooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxhdpi/ic_bluetooth.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_fullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxhdpi/ic_fullscreen.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxhdpi/ic_game.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_info_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxhdpi/ic_info_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_notifications_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxhdpi/ic_notifications_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxhdpi/ic_setting.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxxhdpi/ic_action_gear.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_bluetooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxxhdpi/ic_bluetooth.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxxhdpi/ic_game.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_info_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxxhdpi/ic_info_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_notifications_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxxhdpi/ic_notifications_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxxhdpi/ic_setting.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_sync_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoochit/android-robot-bluetooth-joystick/823960754466e82f40286eaead44fe7e2efbb96f/app/src/main/res/drawable-xxxhdpi/ic_sync_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_base.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_stick.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_stick_pressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_stick_pressed_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_stick_unpressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/layout-land/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | 19 | 20 | 21 | 27 | 28 | 29 | 38 | 39 | 40 |