diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9c4de58
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
new file mode 100644
index 0000000..ee79f7e
Binary files /dev/null and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser
new file mode 100644
index 0000000..22e670f
Binary files /dev/null and b/.idea/caches/gradle_models.ser differ
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..681f41a
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ xmlns:android
+
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+
+ ^$
+
+
+
+
+
+
+
+
+ style
+
+ ^$
+
+
+
+
+
+
+
+
+ .*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+
+ .*
+
+
+ BY_NAME
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..15a15b2
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..f43d428
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..51fa3e5
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..b72ef99
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Bluetooth-Terminal-master.iml b/Bluetooth-Terminal-master.iml
new file mode 100644
index 0000000..531ae38
--- /dev/null
+++ b/Bluetooth-Terminal-master.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BluetoothTerminal.iml b/BluetoothTerminal.iml
new file mode 100644
index 0000000..0dbc091
--- /dev/null
+++ b/BluetoothTerminal.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/RobotArm.iml b/RobotArm.iml
new file mode 100644
index 0000000..049511e
--- /dev/null
+++ b/RobotArm.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/app.iml b/app/app.iml
new file mode 100644
index 0000000..0673f76
--- /dev/null
+++ b/app/app.iml
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..0f33ea5
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,28 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 23
+ buildToolsVersion '28.0.3'
+
+ defaultConfig {
+ applicationId "me.tunca.robotarm"
+ minSdkVersion 21
+ targetSdkVersion 23
+ versionCode 12
+ versionName "3.5"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation 'com.android.support:appcompat-v7:23.4.0'
+
+ implementation 'me.aflak.libraries:bluetooth:1.2.4'
+ implementation 'me.aflak.libraries:pulltorefresh:1.0'
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..4af40f9
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in E:\Users\Omar\AppData\Local\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 *;
+#}
diff --git a/app/src/androidTest/java/me/tunca/robotarm/ApplicationTest.java b/app/src/androidTest/java/me/tunca/robotarm/ApplicationTest.java
new file mode 100644
index 0000000..6b9af5b
--- /dev/null
+++ b/app/src/androidTest/java/me/tunca/robotarm/ApplicationTest.java
@@ -0,0 +1,15 @@
+package me.tunca.robotarm;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase
+{
+ public ApplicationTest()
+ {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..cebcfb4
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/me/tunca/robotarm/About.java b/app/src/main/java/me/tunca/robotarm/About.java
new file mode 100644
index 0000000..403d89a
--- /dev/null
+++ b/app/src/main/java/me/tunca/robotarm/About.java
@@ -0,0 +1,35 @@
+package me.tunca.robotarm;
+/**
+ * Created by Tunca on 05/01/2019.
+ */
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+public class About extends Activity
+{
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.about);
+ LinearLayout aboutLayout = (LinearLayout) findViewById(R.id.ll_about);
+ View childAbout = getLayoutInflater().inflate(R.layout.about, null);
+ aboutLayout.addView(childAbout);
+
+ TextView textTeamInfo = (TextView) findViewById(R.id.teamInfo);
+ textTeamInfo.setTextColor(getResources().getColor(R.color.colorBlack));
+ textTeamInfo.setText(getResources().getString(R.string.about_string));
+
+ int newHeight=288;
+ int newWidth=288;
+ ImageView imageView = (ImageView) findViewById(R.id.robotImage);
+ imageView.setImageResource(R.mipmap.ic_launcher_robot);
+ imageView.getLayoutParams().height=newHeight;
+ imageView.getLayoutParams().width=newWidth;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/me/tunca/robotarm/MainActivity.java b/app/src/main/java/me/tunca/robotarm/MainActivity.java
new file mode 100644
index 0000000..df25e11
--- /dev/null
+++ b/app/src/main/java/me/tunca/robotarm/MainActivity.java
@@ -0,0 +1,825 @@
+package me.tunca.robotarm;
+/**
+ * Created by Tunca on 05/01/2019.
+ */
+import android.annotation.SuppressLint;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.v7.app.AppCompatActivity;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.method.ScrollingMovementMethod;
+import android.text.style.ForegroundColorSpan;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import android.widget.Toast;
+import java.util.Locale;
+import java.util.Objects;
+import me.aflak.bluetooth.Bluetooth;
+
+
+public class MainActivity extends AppCompatActivity implements Bluetooth.CommunicationCallback
+{
+ public static Locale locale = Locale.getDefault();
+ ImageButton buttonUp, buttonDown, buttonForward, buttonBack, buttonRight, buttonLeft, buttonClmpOn, buttonClmpOff;
+ private Bluetooth btDevice;
+ private TextView display;
+ private boolean registered = false;
+ public Runnable mAction;
+ private Handler mHandler;
+ int delayMilis = 16;
+ int postDelayed = 16;
+ String comingData;
+ ProgressBar progressBar;
+ TextView textView;
+
+ @SuppressLint("ClickableViewAccessibility")
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ display = (TextView) findViewById(R.id.display);
+ display.setMovementMethod(new ScrollingMovementMethod());
+
+ btDevice = new Bluetooth(this);
+ btDevice.enableBluetooth();
+
+ btDevice.setCommunicationCallback(this);
+
+ int pos = Objects.requireNonNull(getIntent().getExtras()).getInt("pos");
+
+ Display(getResources().getString(R.string.connect));
+ Display(getResources().getString(R.string.info_btn));
+ btDevice.connectToDevice(btDevice.getPairedDevices().get(pos));
+
+ // Battery
+ LinearLayout battery = (LinearLayout) findViewById(R.id.battery);
+ @SuppressLint("InflateParams") View childBattery = getLayoutInflater().inflate(R.layout.battery, null);
+ assert battery != null;
+ battery.addView(childBattery);
+ progressBar = (ProgressBar) findViewById(R.id.prgBar);
+ final TextView textViewPercent = (TextView) findViewById(R.id.prgBarText_percent);
+ textView = (TextView) findViewById(R.id.prgBarText);
+ if (!btDevice.isConnected())
+ {
+ progressBar.setProgress(0);
+ textView.setText(getResources().getString(R.string.data_wait));
+ }
+
+ assert textViewPercent != null;
+ textViewPercent.setText(progressBar.getProgress() + "%");
+ if (progressBar.getProgress() >= 75 && progressBar.getProgress() <= 100)
+ {
+ progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.battery_bar_green));
+ }
+ else if (progressBar.getProgress() < 75 && progressBar.getProgress() >= 50)
+ {
+ progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.battery_bar_yellow));
+ }
+ else if (progressBar.getProgress() < 50 && progressBar.getProgress() >= 25)
+ {
+ progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.battery_bar_orange));
+ }
+ else if (progressBar.getProgress() < 25 && progressBar.getProgress() >= 0)
+ {
+ progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.battery_bar_red));
+ }
+
+
+ // Control page of servo motors, button assignments and image insertion
+ LinearLayout servo = (LinearLayout) findViewById(R.id.buttons);
+ @SuppressLint("InflateParams") View childServos = getLayoutInflater().inflate(R.layout.buttons, null);
+ if (servo != null)
+ {
+ servo.addView(childServos);
+ }
+ else
+ {
+ Log.e("TAG-MA", "Error adding image cannot insert servo control image");
+ }
+ buttonUp = (ImageButton) childServos.findViewById(R.id.button_up);
+
+ buttonUp.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View view)
+ {
+ btDevice.send("1");
+ Display(getResources().getString(R.string.move_up));
+ Log.e("TAG-MA", "up : 1");
+ }
+ });
+
+ buttonUp.setOnTouchListener(new View.OnTouchListener()
+ {
+ @Override
+ public boolean onTouch(View v, MotionEvent event)
+ {
+ switch (event.getAction())
+ {
+ case MotionEvent.ACTION_DOWN:
+ buttonClickable(1, true);
+ sendDataAction("1", 1);
+ Log.e("Data :", "Veri : 1");
+ mHandler = new Handler();
+ mHandler.postDelayed(mAction, postDelayed);
+ break;
+
+ case MotionEvent.ACTION_UP:
+ if (mHandler == null)
+ {
+ return true;
+ }
+ mHandler.removeCallbacks(mAction);
+ mHandler = null;
+ buttonClickable(0, true);
+ break;
+ }
+ return false;
+ }
+ });
+
+ buttonDown = (ImageButton) childServos.findViewById(R.id.button_down);
+
+ buttonDown.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View view)
+ {
+ btDevice.send("2");
+ Display(getResources().getString(R.string.move_down));
+ Log.e("TAG-MA", "down : 2");
+ }
+ });
+
+ buttonDown.setOnTouchListener(new View.OnTouchListener()
+ {
+ @Override
+ public boolean onTouch(View v, MotionEvent event)
+ {
+ switch (event.getAction())
+ {
+ case MotionEvent.ACTION_DOWN:
+ buttonClickable(2, true);
+ sendDataAction("2", 2);
+ mHandler = new Handler();
+ mHandler.postDelayed(mAction, postDelayed);
+ break;
+ case MotionEvent.ACTION_UP:
+ if (mHandler == null)
+ {
+ return true;
+ }
+ mHandler.removeCallbacks(mAction);
+ mHandler = null;
+ buttonClickable(0, true);
+ break;
+
+ }
+ return false;
+ }
+ });
+
+
+ buttonForward = (ImageButton) childServos.findViewById(R.id.button_forward);
+
+ buttonForward.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View view)
+ {
+ btDevice.send("3");
+ Display(getResources().getString(R.string.move_forward));
+ Log.e("TAG-MA", "forward : 3");
+ }
+ });
+
+ buttonForward.setOnTouchListener(new View.OnTouchListener()
+ {
+ @Override
+ public boolean onTouch(View v, MotionEvent event)
+ {
+ switch (event.getAction())
+ {
+ case MotionEvent.ACTION_DOWN:
+
+ buttonClickable(3, true);
+ sendDataAction("3", 3);
+ mHandler = new Handler();
+ mHandler.postDelayed(mAction, postDelayed);
+ break;
+ case MotionEvent.ACTION_UP:
+ if (mHandler == null)
+ {
+ return true;
+ }
+ mHandler.removeCallbacks(mAction);
+ mHandler = null;
+ buttonClickable(0, true);
+ break;
+
+ }
+ return false;
+ }
+ });
+
+ buttonBack = (ImageButton) childServos.findViewById(R.id.button_back);
+
+ buttonBack.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View view)
+ {
+ btDevice.send("4");
+ Display(getResources().getString(R.string.move_backward));
+ Log.e("TAG-MA", "back : 4");
+ }
+ });
+
+ buttonBack.setOnTouchListener(new View.OnTouchListener()
+ {
+ @Override
+ public boolean onTouch(View v, MotionEvent event)
+ {
+ switch (event.getAction())
+ {
+ case MotionEvent.ACTION_DOWN:
+ buttonClickable(4, true);
+ sendDataAction("4", 4);
+ mHandler = new Handler();
+ mHandler.postDelayed(mAction, postDelayed);
+ break;
+ case MotionEvent.ACTION_UP:
+ if (mHandler == null)
+ {
+ return true;
+ }
+ mHandler.removeCallbacks(mAction);
+ mHandler = null;
+ buttonClickable(0, true);
+ break;
+ }
+ return false;
+ }
+ });
+
+ buttonRight = (ImageButton) childServos.findViewById(R.id.button_right);
+
+ buttonRight.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View view)
+ {
+ btDevice.send("5");
+ Display(getResources().getString(R.string.turn_right));
+ Log.e("TAG-MA", "right : 5");
+ }
+ });
+
+ buttonRight.setOnTouchListener(new View.OnTouchListener()
+ {
+ @Override
+ public boolean onTouch(View v, MotionEvent event)
+ {
+ switch (event.getAction())
+ {
+ case MotionEvent.ACTION_DOWN:
+ buttonClickable(5, true);
+ sendDataAction("5", 5);
+ mHandler = new Handler();
+ mHandler.postDelayed(mAction, postDelayed);
+ break;
+ case MotionEvent.ACTION_UP:
+ if (mHandler == null)
+ {
+ return true;
+ }
+ mHandler.removeCallbacks(mAction);
+ mHandler = null;
+ buttonClickable(0, true);
+ break;
+ }
+ return false;
+ }
+ });
+
+ buttonLeft = (ImageButton) childServos.findViewById(R.id.button_left);
+
+ buttonLeft.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View view)
+ {
+ btDevice.send("6");
+ Display(getResources().getString(R.string.turn_left));
+ Log.e("TAG-MA", "left : 6");
+ }
+ });
+
+ buttonLeft.setOnTouchListener(new View.OnTouchListener()
+ {
+ @Override
+ public boolean onTouch(View v, MotionEvent event)
+ {
+ switch (event.getAction())
+ {
+ case MotionEvent.ACTION_DOWN:
+
+ buttonClickable(6, true);
+ sendDataAction("6", 6);
+ mHandler = new Handler();
+ mHandler.postDelayed(mAction, postDelayed);
+ break;
+ case MotionEvent.ACTION_UP:
+ if (mHandler == null)
+ {
+ return true;
+ }
+ mHandler.removeCallbacks(mAction);
+ mHandler = null;
+ buttonClickable(0, true);
+ break;
+
+ }
+ return false;
+ }
+ });
+
+ buttonClmpOn = (ImageButton) childServos.findViewById(R.id.button_clampon);
+ buttonClmpOn.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View view)
+ {
+ btDevice.send("7");
+ Display(getResources().getString(R.string.clamp_on));
+ Log.e("TAG-MA", "clmpOn : 7");
+ // operation =-1;
+
+ }
+ });
+
+ buttonClmpOn.setOnTouchListener(new View.OnTouchListener()
+ {
+ @Override
+ public boolean onTouch(View v, MotionEvent event)
+ {
+ switch (event.getAction())
+ {
+ case MotionEvent.ACTION_DOWN:
+ buttonClickable(7, true);
+ sendDataAction("7", 7);
+
+ mHandler = new Handler();
+ mHandler.postDelayed(mAction, postDelayed);
+ break;
+ case MotionEvent.ACTION_UP:
+ if (mHandler == null)
+ {
+ return true;
+ }
+ mHandler.removeCallbacks(mAction);
+ mHandler = null;
+ buttonClickable(0, true);
+ break;
+
+ }
+ return false;
+ }
+ });
+
+ buttonClmpOff = (ImageButton) childServos.findViewById(R.id.button_clampoff);
+ buttonClmpOff.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View view)
+ {
+ btDevice.send("8");
+ Display(getResources().getString(R.string.clamp_off));
+ Log.e("TAG-MA", "clmpOff : 8");
+
+ }
+ });
+
+ buttonClmpOff.setOnTouchListener(new View.OnTouchListener()
+ {
+ @Override
+ public boolean onTouch(View v, MotionEvent event)
+ {
+ switch (event.getAction())
+ {
+ case MotionEvent.ACTION_DOWN:
+
+ buttonClickable(8, true);
+ sendDataAction("8", 8);
+ mHandler = new Handler();
+ mHandler.postDelayed(mAction, postDelayed);
+ break;
+ case MotionEvent.ACTION_UP:
+ if (mHandler == null)
+ {
+ return true;
+ }
+ mHandler.removeCallbacks(mAction);
+ mHandler = null;
+ buttonClickable(0, true);
+ break;
+ }
+ return false;
+ }
+ });
+
+ Button clearButton = (Button) findViewById(R.id.button_clear);
+ assert clearButton != null;
+ clearButton.setText(getResources().getString(R.string.clear_feedback));
+ clearButton.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View view)
+ {
+ display.setText("");
+ Toast.makeText(getApplicationContext(), getResources().getString(R.string.clear_info_toast), Toast.LENGTH_SHORT).show();
+ }
+ });
+ buttonClickable(0, false);
+ IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
+ registerReceiver(mReceiver, filter);
+ registered = true;
+ }
+
+
+ @Override
+ public void onDestroy()
+ {
+ super.onDestroy();
+ if (registered)
+ {
+ unregisterReceiver(mReceiver);
+ registered = false;
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu)
+ {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.menu_main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item)
+ {
+ // Handle item selection
+ switch (item.getItemId())
+ {
+ case R.id.close:
+ btDevice.removeCommunicationCallback();
+ btDevice.disconnect();
+ Intent intentSelect = new Intent(this, Select.class);
+ startActivity(intentSelect);
+ finish();
+ return true;
+ case R.id.about:
+ Intent intentAbout = new Intent(this, About.class);
+ startActivity(intentAbout);
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ public void Display(final String s)
+ {
+ this.runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ display.append("\n");
+ display.append(s);
+ }
+ });
+ }
+
+
+ // 0 Black (Default)
+ // 1 Green (for Device İnfo)
+ // 2 Red (for Error)
+ // 3 Mavi (for Callback)
+ public void Display(final String s, final int color, final int start)
+ {
+ this.runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ SpannableString ss = new SpannableString(s);
+ if (color == 1)
+ {
+ ss.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.colorGreen)), start, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
+ else if (color == 2)
+ {
+ ss.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.colorRed)), start, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
+ else if (color == 3)
+ {
+ ss.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.colorBlue)), start, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
+ else
+ {
+ ss.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.colorBlack)), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
+
+ display.append("\n");
+ display.append(ss);
+ }
+ });
+ }
+
+ @Override
+ public void onConnect(BluetoothDevice device)
+ {
+ String s = getResources().getString(R.string.connect_device) + device.getName() + " - " + device.getAddress();
+ Display(s, 1, 19);
+ this.runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ buttonClickable(0, true);
+ }
+ });
+ }
+
+
+ @Override
+ public void onDisconnect(BluetoothDevice device, String message)
+ {
+ Display(getResources().getString(R.string.disconnect));
+ Display(getResources().getString(R.string.reconnect));
+ Display(getResources().getString(R.string.btn_inactive));
+ btDevice.connectToDevice(device);
+ textView.setText(getResources().getString(R.string.connect_wait));
+ Log.e("TAG-Message", "onDisconnect Message : " + message);
+ this.runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ buttonClickable(0, false);
+ }
+ });
+
+ }
+
+ @Override
+ public void onMessage(String message)
+ {
+ comingData = message;
+ // As soon as the message arrives, the data belongs to the battery.
+ progressBar.setProgress(Integer.parseInt(comingData));
+ textView.setText(getResources().getString(R.string.data_process));
+ Log.e("TAG-Message", "onMassage Message : " + message);
+ }
+
+ @Override
+ public void onError(String message)
+ {
+ Display(getResources().getString(R.string.error) + message);
+ }
+
+ @Override
+ public void onConnectError(final BluetoothDevice device, String message)
+ {
+ String s = getResources().getString(R.string.error) + message;
+ Display(s, 2, 6);
+ Display(getResources().getString(R.string.retrying));
+ runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ Handler handler = new Handler();
+ handler.postDelayed(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ btDevice.connectToDevice(device);
+ }
+ }, 2000);
+ }
+ });
+ }
+
+ private final BroadcastReceiver mReceiver = new BroadcastReceiver()
+ {
+ @Override
+ public void onReceive(Context context, Intent intent)
+ {
+ final String action = intent.getAction();
+
+ assert action != null;
+ if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED))
+ {
+ final int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
+ Intent intent1 = new Intent(MainActivity.this, Select.class);
+
+ switch (state)
+ {
+ case BluetoothAdapter.STATE_OFF:
+ if (registered)
+ {
+ unregisterReceiver(mReceiver);
+ registered = false;
+ }
+ startActivity(intent1);
+ finish();
+ break;
+ case BluetoothAdapter.STATE_TURNING_OFF:
+ if (registered)
+ {
+ unregisterReceiver(mReceiver);
+ registered = false;
+ }
+ startActivity(intent1);
+ finish();
+ break;
+ }
+ }
+ }
+ };
+
+ public void sendDataAction(final String s, final int pos)
+ {
+ mAction = new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ btDevice.send(s);
+ displayData(pos);
+ mHandler.postDelayed(this, delayMilis);
+ }
+ };
+ }
+
+ public void displayData(int s)
+ {
+ switch (s)
+ {
+ case 1:
+ Display(getResources().getString(R.string.move_up));
+ break;
+ case 2:
+ Display(getResources().getString(R.string.move_down));
+ break;
+ case 3:
+ Display(getResources().getString(R.string.move_forward));
+ break;
+ case 4:
+ Display(getResources().getString(R.string.move_backward));
+ break;
+ case 5:
+ Display(getResources().getString(R.string.turn_right));
+ break;
+ case 6:
+ Display(getResources().getString(R.string.turn_left));
+ break;
+ case 7:
+ Display(getResources().getString(R.string.clamp_on));
+ break;
+ case 8:
+ Display(getResources().getString(R.string.clamp_off));
+ break;
+ }
+ }
+
+ public void buttonClickable(int pos, boolean bool)
+ {
+
+ if (0 < pos && pos > 8)
+ {
+ pos = 0;
+ }
+ else if (pos == 0)
+ {
+ buttonUp.setEnabled(bool);
+ buttonDown.setEnabled(bool);
+ buttonForward.setEnabled(bool);
+ buttonBack.setEnabled(bool);
+ buttonRight.setEnabled(bool);
+ buttonLeft.setEnabled(bool);
+ buttonClmpOn.setEnabled(bool);
+ buttonClmpOff.setEnabled(bool);
+ }
+ else
+ {
+ switch (pos)
+ {
+ case 1:
+ buttonUp.setEnabled(bool);
+ buttonDown.setEnabled(false);
+ buttonForward.setEnabled(false);
+ buttonBack.setEnabled(false);
+ buttonRight.setEnabled(false);
+ buttonLeft.setEnabled(false);
+ buttonClmpOn.setEnabled(false);
+ buttonClmpOff.setEnabled(false);
+ break;
+ case 2:
+ buttonUp.setEnabled(false);
+ buttonDown.setEnabled(bool);
+ buttonForward.setEnabled(false);
+ buttonBack.setEnabled(false);
+ buttonRight.setEnabled(false);
+ buttonLeft.setEnabled(false);
+ buttonClmpOn.setEnabled(false);
+ buttonClmpOff.setEnabled(false);
+ break;
+ case 3:
+ buttonUp.setEnabled(false);
+ buttonDown.setEnabled(false);
+ buttonForward.setEnabled(bool);
+ buttonBack.setEnabled(false);
+ buttonRight.setEnabled(false);
+ buttonLeft.setEnabled(false);
+ buttonClmpOn.setEnabled(false);
+ buttonClmpOff.setEnabled(false);
+ break;
+ case 4:
+ buttonUp.setEnabled(false);
+ buttonDown.setEnabled(false);
+ buttonForward.setEnabled(false);
+ buttonBack.setEnabled(bool);
+ buttonRight.setEnabled(false);
+ buttonLeft.setEnabled(false);
+ buttonClmpOn.setEnabled(false);
+ buttonClmpOff.setEnabled(false);
+ break;
+ case 5:
+ buttonUp.setEnabled(false);
+ buttonDown.setEnabled(false);
+ buttonForward.setEnabled(false);
+ buttonBack.setEnabled(false);
+ buttonRight.setEnabled(bool);
+ buttonLeft.setEnabled(false);
+ buttonClmpOn.setEnabled(false);
+ buttonClmpOff.setEnabled(false);
+ break;
+ case 6:
+ buttonUp.setEnabled(false);
+ buttonDown.setEnabled(false);
+ buttonForward.setEnabled(false);
+ buttonBack.setEnabled(false);
+ buttonRight.setEnabled(false);
+ buttonLeft.setEnabled(bool);
+ buttonClmpOn.setEnabled(false);
+ buttonClmpOff.setEnabled(false);
+ break;
+ case 7:
+ buttonUp.setEnabled(false);
+ buttonDown.setEnabled(false);
+ buttonForward.setEnabled(false);
+ buttonBack.setEnabled(false);
+ buttonRight.setEnabled(false);
+ buttonLeft.setEnabled(false);
+ buttonClmpOn.setEnabled(bool);
+ buttonClmpOff.setEnabled(false);
+ break;
+ case 8:
+ buttonUp.setEnabled(false);
+ buttonDown.setEnabled(false);
+ buttonForward.setEnabled(false);
+ buttonBack.setEnabled(false);
+ buttonRight.setEnabled(false);
+ buttonLeft.setEnabled(false);
+ buttonClmpOn.setEnabled(false);
+ buttonClmpOff.setEnabled(bool);
+ break;
+ }
+ }
+
+ }
+
+
+}
diff --git a/app/src/main/java/me/tunca/robotarm/Scan.java b/app/src/main/java/me/tunca/robotarm/Scan.java
new file mode 100644
index 0000000..b604fe7
--- /dev/null
+++ b/app/src/main/java/me/tunca/robotarm/Scan.java
@@ -0,0 +1,168 @@
+package me.tunca.robotarm;
+/**
+ * Created by Tunca on 05/01/2019.
+ */
+import android.app.Activity;
+import android.bluetooth.BluetoothDevice;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.ListView;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import java.util.ArrayList;
+import java.util.List;
+import me.aflak.bluetooth.Bluetooth;
+
+public class Scan extends Activity implements Bluetooth.DiscoveryCallback, AdapterView.OnItemClickListener
+{
+
+ private Bluetooth bluetooth;
+ private ListView listView;
+ private ArrayAdapter adapter;
+ private TextView state;
+ private ProgressBar progress;
+ private Button scan;
+ private List devices;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.scan);
+
+ listView = (ListView) findViewById(R.id.scan_list);
+ state = (TextView) findViewById(R.id.scan_state);
+ progress = (ProgressBar) findViewById(R.id.scan_progress);
+ scan = (Button) findViewById(R.id.scan_scan_again);
+
+ adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, new ArrayList());
+ listView.setAdapter(adapter);
+ listView.setOnItemClickListener(this);
+
+ bluetooth = new Bluetooth(this);
+ bluetooth.setDiscoveryCallback(this);
+
+ bluetooth.scanDevices();
+ progress.setVisibility(View.VISIBLE);
+ state.setText(getResources().getString(R.string.scan));
+ listView.setEnabled(false);
+
+ scan.setEnabled(false);
+ devices = new ArrayList<>();
+
+ scan.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View v)
+ {
+ runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ adapter.clear();
+ scan.setEnabled(false);
+ }
+ });
+
+ devices = new ArrayList<>();
+ progress.setVisibility(View.VISIBLE);
+ state.setText(getResources().getString(R.string.scan));
+ bluetooth.scanDevices();
+ }
+ });
+ }
+
+ private void setText(final String txt)
+ {
+ runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ state.setText(txt);
+ }
+ });
+ }
+
+ private void setProgressVisibility(final int id)
+ {
+ runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ progress.setVisibility(id);
+ }
+ });
+ }
+
+ @Override
+ public void onFinish()
+ {
+ setProgressVisibility(View.INVISIBLE);
+ setText(getResources().getString(R.string.scan_finish));
+ runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ scan.setEnabled(true);
+ listView.setEnabled(true);
+ }
+ });
+ }
+
+ @Override
+ public void onDevice(final BluetoothDevice device)
+ {
+ final BluetoothDevice tmp = device;
+ devices.add(device);
+
+ runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ adapter.add(tmp.getAddress() + " - " + tmp.getName());
+ }
+ });
+ }
+
+ @Override
+ public void onPair(BluetoothDevice device)
+ {
+ setProgressVisibility(View.INVISIBLE);
+ setText(getResources().getString(R.string.paired));
+ Intent i = new Intent(Scan.this, Select.class);
+ startActivity(i);
+ finish();
+ }
+
+ @Override
+ public void onUnpair(BluetoothDevice device)
+ {
+ setProgressVisibility(View.INVISIBLE);
+ setText(getResources().getString(R.string.paired));
+ }
+
+ @Override
+ public void onError(String message)
+ {
+ setProgressVisibility(View.INVISIBLE);
+ setText(getResources().getString(R.string.error) + message);
+ }
+
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id)
+ {
+ setProgressVisibility(View.VISIBLE);
+ setText(getResources().getString(R.string.pairing));
+ bluetooth.pair(devices.get(position));
+ }
+}
diff --git a/app/src/main/java/me/tunca/robotarm/Select.java b/app/src/main/java/me/tunca/robotarm/Select.java
new file mode 100644
index 0000000..6af41c0
--- /dev/null
+++ b/app/src/main/java/me/tunca/robotarm/Select.java
@@ -0,0 +1,180 @@
+package me.tunca.robotarm;
+/**
+ * Created by Tunca on 05/01/2019.
+ */
+import android.app.Activity;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.ListView;
+import android.widget.Toast;
+import java.util.ArrayList;
+import java.util.List;
+import me.aflak.bluetooth.Bluetooth;
+import me.aflak.pulltorefresh.PullToRefresh;
+
+
+public class Select extends Activity implements PullToRefresh.OnRefreshListener
+{
+ private Bluetooth bt;
+ private ListView listView;
+ private Button not_found;
+ private List paired;
+ private PullToRefresh pull_to_refresh;
+ private boolean registered = false;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.select);
+
+ IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
+ registerReceiver(mReceiver, filter);
+ registered = true;
+
+ bt = new Bluetooth(this);
+ bt.enableBluetooth();
+
+ pull_to_refresh = (PullToRefresh) findViewById(R.id.pull_to_refresh);
+ listView = (ListView) findViewById(R.id.list);
+ not_found = (Button) findViewById(R.id.not_in_list);
+
+ pull_to_refresh.setListView(listView);
+ pull_to_refresh.setOnRefreshListener(this);
+ pull_to_refresh.setSlide(500);
+
+ listView.setOnItemClickListener(new AdapterView.OnItemClickListener()
+ {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id)
+ {
+ Intent i = new Intent(Select.this, MainActivity.class);
+ i.putExtra("pos", position);
+ if (registered)
+ {
+ unregisterReceiver(mReceiver);
+ registered = false;
+ }
+ startActivity(i);
+ finish();
+ }
+ });
+
+ not_found.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View v)
+ {
+ Intent i = new Intent(Select.this, Scan.class);
+ startActivity(i);
+ }
+ });
+
+ addDevicesToList();
+ }
+
+ @Override
+ public void onRefresh()
+ {
+ List names = new ArrayList<>();
+ for (BluetoothDevice d : bt.getPairedDevices())
+ {
+ names.add(d.getName());
+ }
+
+ String[] array = names.toArray(new String[names.size()]);
+ final ArrayAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, android.R.id.text1, array);
+
+ this.runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ listView.removeViews(0, listView.getCount());
+ listView.setAdapter(adapter);
+ paired = bt.getPairedDevices();
+ }
+ });
+ pull_to_refresh.refreshComplete();
+ }
+
+ @Override
+ public void onDestroy()
+ {
+ super.onDestroy();
+ if (registered)
+ {
+ unregisterReceiver(mReceiver);
+ registered = false;
+ }
+ }
+
+ private void addDevicesToList()
+ {
+ paired = bt.getPairedDevices();
+
+ List names = new ArrayList<>();
+ for (BluetoothDevice d : paired)
+ {
+ names.add(d.getName());
+ }
+
+ String[] array = names.toArray(new String[names.size()]);
+
+ ArrayAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, android.R.id.text1, array);
+
+ listView.setAdapter(adapter);
+
+ not_found.setEnabled(true);
+ }
+
+ private final BroadcastReceiver mReceiver = new BroadcastReceiver()
+ {
+ @Override
+ public void onReceive(Context context, Intent intent)
+ {
+ final String action = intent.getAction();
+
+ if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED))
+ {
+ final int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
+
+ switch (state)
+ {
+ case BluetoothAdapter.STATE_OFF:
+ runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ listView.setEnabled(false);
+ }
+ });
+ Toast.makeText(Select.this, getResources().getString(R.string.bluetooth_on), Toast.LENGTH_LONG).show();
+ break;
+ case BluetoothAdapter.STATE_ON:
+ runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ addDevicesToList();
+ listView.setEnabled(true);
+ }
+ });
+ break;
+ }
+ }
+ }
+ };
+}
+
diff --git a/app/src/main/res/drawable/arrow_down.png b/app/src/main/res/drawable/arrow_down.png
new file mode 100644
index 0000000..e175cd7
Binary files /dev/null and b/app/src/main/res/drawable/arrow_down.png differ
diff --git a/app/src/main/res/drawable/arrow_left.png b/app/src/main/res/drawable/arrow_left.png
new file mode 100644
index 0000000..b53d5d1
Binary files /dev/null and b/app/src/main/res/drawable/arrow_left.png differ
diff --git a/app/src/main/res/drawable/arrow_right.png b/app/src/main/res/drawable/arrow_right.png
new file mode 100644
index 0000000..fc566e4
Binary files /dev/null and b/app/src/main/res/drawable/arrow_right.png differ
diff --git a/app/src/main/res/drawable/arrow_up.png b/app/src/main/res/drawable/arrow_up.png
new file mode 100644
index 0000000..0108111
Binary files /dev/null and b/app/src/main/res/drawable/arrow_up.png differ
diff --git a/app/src/main/res/drawable/battery_bar_green.xml b/app/src/main/res/drawable/battery_bar_green.xml
new file mode 100644
index 0000000..a79bfd8
--- /dev/null
+++ b/app/src/main/res/drawable/battery_bar_green.xml
@@ -0,0 +1,25 @@
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/battery_bar_orange.xml b/app/src/main/res/drawable/battery_bar_orange.xml
new file mode 100644
index 0000000..b596db0
--- /dev/null
+++ b/app/src/main/res/drawable/battery_bar_orange.xml
@@ -0,0 +1,25 @@
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/battery_bar_red.xml b/app/src/main/res/drawable/battery_bar_red.xml
new file mode 100644
index 0000000..111f374
--- /dev/null
+++ b/app/src/main/res/drawable/battery_bar_red.xml
@@ -0,0 +1,25 @@
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/battery_bar_yellow.xml b/app/src/main/res/drawable/battery_bar_yellow.xml
new file mode 100644
index 0000000..dcbf931
--- /dev/null
+++ b/app/src/main/res/drawable/battery_bar_yellow.xml
@@ -0,0 +1,25 @@
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/button_selector.xml b/app/src/main/res/drawable/button_selector.xml
new file mode 100644
index 0000000..0efae77
--- /dev/null
+++ b/app/src/main/res/drawable/button_selector.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/clamp_off.png b/app/src/main/res/drawable/clamp_off.png
new file mode 100644
index 0000000..3020d47
Binary files /dev/null and b/app/src/main/res/drawable/clamp_off.png differ
diff --git a/app/src/main/res/drawable/clamp_on.png b/app/src/main/res/drawable/clamp_on.png
new file mode 100644
index 0000000..c776c07
Binary files /dev/null and b/app/src/main/res/drawable/clamp_on.png differ
diff --git a/app/src/main/res/drawable/customborder.xml b/app/src/main/res/drawable/customborder.xml
new file mode 100644
index 0000000..b7fbe76
--- /dev/null
+++ b/app/src/main/res/drawable/customborder.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/flag_eng.png b/app/src/main/res/drawable/flag_eng.png
new file mode 100644
index 0000000..3835dbf
Binary files /dev/null and b/app/src/main/res/drawable/flag_eng.png differ
diff --git a/app/src/main/res/drawable/flag_turk.png b/app/src/main/res/drawable/flag_turk.png
new file mode 100644
index 0000000..762eec1
Binary files /dev/null and b/app/src/main/res/drawable/flag_turk.png differ
diff --git a/app/src/main/res/drawable/turn_left.png b/app/src/main/res/drawable/turn_left.png
new file mode 100644
index 0000000..6484818
Binary files /dev/null and b/app/src/main/res/drawable/turn_left.png differ
diff --git a/app/src/main/res/drawable/turn_right.png b/app/src/main/res/drawable/turn_right.png
new file mode 100644
index 0000000..b01fe83
Binary files /dev/null and b/app/src/main/res/drawable/turn_right.png differ
diff --git a/app/src/main/res/layout/about.xml b/app/src/main/res/layout/about.xml
new file mode 100644
index 0000000..670ea59
--- /dev/null
+++ b/app/src/main/res/layout/about.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..ae14e4d
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/battery.xml b/app/src/main/res/layout/battery.xml
new file mode 100644
index 0000000..f056a9c
--- /dev/null
+++ b/app/src/main/res/layout/battery.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/buttons.xml b/app/src/main/res/layout/buttons.xml
new file mode 100644
index 0000000..210f4bb
--- /dev/null
+++ b/app/src/main/res/layout/buttons.xml
@@ -0,0 +1,240 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/language.xml b/app/src/main/res/layout/language.xml
new file mode 100644
index 0000000..0c9a40b
--- /dev/null
+++ b/app/src/main/res/layout/language.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/scan.xml b/app/src/main/res/layout/scan.xml
new file mode 100644
index 0000000..74cb586
--- /dev/null
+++ b/app/src/main/res/layout/scan.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/select.xml b/app/src/main/res/layout/select.xml
new file mode 100644
index 0000000..f0b3c83
--- /dev/null
+++ b/app/src/main/res/layout/select.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/splash.xml b/app/src/main/res/layout/splash.xml
new file mode 100644
index 0000000..3a3185d
--- /dev/null
+++ b/app/src/main/res/layout/splash.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..8dbbe02
--- /dev/null
+++ b/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,10 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_robot.png b/app/src/main/res/mipmap-hdpi/ic_launcher_robot.png
new file mode 100644
index 0000000..186e1b0
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_robot.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_robot.png b/app/src/main/res/mipmap-mdpi/ic_launcher_robot.png
new file mode 100644
index 0000000..26a740c
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_robot.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_robot.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_robot.png
new file mode 100644
index 0000000..4fda06b
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_robot.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_robot.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_robot.png
new file mode 100644
index 0000000..64a2e7a
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_robot.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_robot.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_robot.png
new file mode 100644
index 0000000..10686cc
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_robot.png differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..b23c235
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,16 @@
+
+
+ #008577
+ #00574B
+ #D81B60
+ #001381
+ #000000
+ #bc1212
+ #006905
+ #e6e600
+ #d96900
+ #454545
+ #33B5E5
+ #FFFFFF
+
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..47c8224
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..963dda8
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,54 @@
+
+ Robot Arm
+
+ Hello world!
+ Settings
+ This APP; similar to the picture allows\n
+ the robot arms to move with the help of bluetooth\n
+ Github: alperTunca\n
+ Email: atunca51@hotmail.com\n
+ #C0C0C0
+
+ Scanning…
+ Scan Finished !
+ Paired !
+ "Error: "
+ Pairing !
+ Processing Data…
+ Clear Feedback
+ Information page cleared.
+ Waiting for Connection…
+ Waiting for Data.
+ Connecting…
+ Buttons Inactive Until Connection Completed.
+ Turn on Bluetooth.
+ Clamp closing
+ Clamp Opening
+ Left turn active
+ Right turn active
+ Up motion active
+ Down motion active
+ Backward motion active
+ Forward motion active
+ Retrying…
+ Disconnected !
+ Reconnecting…
+ Buttons Inactive
+ Connected device :
+ Back
+ Down
+ Forward
+ Left
+ Right
+ Up
+ Clamp On
+ Clamp Off
+ Okey
+ Cancel
+ Choose Language
+ Close Connection
+ About
+ Your langugage is English
+ Scan Again
+ "Battery Health : "
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..766ab99
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..60fcbf5
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,21 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ google()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.4.2'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ google()
+ }
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..1d3591c
--- /dev/null
+++ b/gradle.properties
@@ -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
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8c0fb64
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..3d7e906
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Fri Jun 14 03:38:20 EET 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..91a7e26
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,164 @@
+#!/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
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# 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\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+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"`
+
+ # 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 "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/gradlew.bat
@@ -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
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'