Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ android:
- tools

# The BuildTools version used by your project
- build-tools-25.0.3
- build-tools-28.0.3

# The SDK version used to compile your project
- android-25
- android-28

# Additional components
- extra-android-m2repository
Expand Down
23 changes: 15 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
applicationId 'com.lauszus.balancingrobotfullsizeandroid.app'
minSdkVersion 14
targetSdkVersion 25
minSdkVersion 19
targetSdkVersion 28
versionCode 2
versionName '1.0.1'
}
Expand All @@ -27,6 +27,10 @@ android {
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}

repositories {
Expand All @@ -36,11 +40,14 @@ repositories {
}

dependencies {
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.jjoe64:graphview:3.1.4'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
// TODO Upgrade to 4.
implementation 'com.jjoe64:graphview:3.1.4'
// TODO: Use Maven repo instead
compile(name: 'SpeedometerView-1.0.1', ext: 'aar')
implementation 'com.cardiomood.android:android-widgets:0.1.1'
//implementation 'com.cardiomood.android.speedometer:speedometer:1.0.1'
//implementation (name: 'SpeedometerView-1.0.1', ext: 'aar')
}

// These values are all set in my global gradle.properties file
Expand Down
4 changes: 3 additions & 1 deletion app/libs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Libraries used that are not located at Maven Central are located here.

### SpeedometerView
* Source: <https://github.com/ntoskrnl/SpeedometerView>
* Source: <https://github.com/ntoskrnl/SpeedometerView>

PP voir compile 'com.cardiomood.android:android-widgets:0.1.1'
6 changes: 4 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.lauszus.balancingrobotfullsizeandroid.app" >

<!-- Used for Bluetooth communication -->
Expand All @@ -26,7 +27,8 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">

<!-- Meta-data used by Google Maps - note that the API key is stored locally and not published on Github. Please read: https://developers.google.com/maps/documentation/android/ -->
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
Expand All @@ -36,7 +38,7 @@
android:name=".BalancingRobotFullSizeActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:theme="@style/AppTheme.NoActionBar" >
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*************************************************************************************
/* ************************************************************************************
* Copyright (C) 2014 Kristian Sloth Lauszus. All rights reserved.
*
* This software may be distributed and modified under the terms of the GNU
Expand All @@ -19,29 +19,23 @@

package com.lauszus.balancingrobotfullsizeandroid.app;

import android.annotation.TargetApi;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothManager;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;

import java.lang.ref.WeakReference;
import android.annotation.*;
import android.bluetooth.*;
import android.content.*;
import android.os.*;
import android.util.*;
import android.view.*;
import android.view.inputmethod.*;
import android.widget.*;

import androidx.appcompat.app.*;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.*;
import androidx.viewpager.widget.*;

import com.google.android.material.tabs.*;

import java.lang.ref.*;

public class BalancingRobotFullSizeActivity extends AppCompatActivity implements TabLayout.OnTabSelectedListener {
private static final String TAG = "BalancingRobotFullSize";
Expand Down Expand Up @@ -178,10 +172,8 @@ public void onStart() {
@Override
public void onBackPressed() {
if (mChatService != null) {
new Handler().postDelayed(new Runnable() {
public void run() {
mChatService.stop(); // Stop the Bluetooth chat services if the user exits the app
}
new Handler().postDelayed(() -> {
mChatService.stop(); // Stop the Bluetooth chat services if the user exits the app
}, 1000); // Wait 1 second before closing the connection, this is needed as onPause() will send stop messages before closing
}
finish(); // Exits the app
Expand Down Expand Up @@ -305,6 +297,7 @@ public boolean checkTab(int tab) {
return (currentTabSelected == tab);
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (D)
Log.d(TAG, "onActivityResult " + resultCode);
Expand Down Expand Up @@ -381,36 +374,30 @@ public void handleMessage(Message msg) {
if (mBalancingRobotFullSizeActivity.mChatService == null)
return;
Handler mHandler = new Handler();
mHandler.postDelayed(new Runnable() {
public void run() {
BalancingRobotFullSizeActivity mBalancingRobotFullSizeActivity = mActivity.get();
if (mBalancingRobotFullSizeActivity != null) {
mBalancingRobotFullSizeActivity.mChatService.mBluetoothProtocol.getPID();
mBalancingRobotFullSizeActivity.mChatService.mBluetoothProtocol.getTarget();
mBalancingRobotFullSizeActivity.mChatService.mBluetoothProtocol.getTurning();
mBalancingRobotFullSizeActivity.mChatService.mBluetoothProtocol.getKalman();
}
mHandler.postDelayed(() -> {
BalancingRobotFullSizeActivity mBalancingRobotFullSizeActivity13 = mActivity.get();
if (mBalancingRobotFullSizeActivity13 != null) {
mBalancingRobotFullSizeActivity13.mChatService.mBluetoothProtocol.getPID();
mBalancingRobotFullSizeActivity13.mChatService.mBluetoothProtocol.getTarget();
mBalancingRobotFullSizeActivity13.mChatService.mBluetoothProtocol.getTurning();
mBalancingRobotFullSizeActivity13.mChatService.mBluetoothProtocol.getKalman();
}
}, 1000); // Wait 1 second before sending the message

if (mBalancingRobotFullSizeActivity.checkTab(ViewPagerAdapter.INFO_FRAGMENT)) {
mHandler.postDelayed(new Runnable() {
public void run() {
BalancingRobotFullSizeActivity mBalancingRobotFullSizeActivity = mActivity.get();
if (mBalancingRobotFullSizeActivity != null)
mBalancingRobotFullSizeActivity.mChatService.mBluetoothProtocol.startInfo(); // Request info
}
mHandler.postDelayed(() -> {
BalancingRobotFullSizeActivity mBalancingRobotFullSizeActivity12 = mActivity.get();
if (mBalancingRobotFullSizeActivity12 != null)
mBalancingRobotFullSizeActivity12.mChatService.mBluetoothProtocol.startInfo(); // Request info
}, 2000); // Wait 2 seconds before sending the message
} else if (mBalancingRobotFullSizeActivity.checkTab(ViewPagerAdapter.GRAPH_FRAGMENT)) {
mHandler.postDelayed(new Runnable() {
public void run() {
BalancingRobotFullSizeActivity mBalancingRobotFullSizeActivity = mActivity.get();
if (mBalancingRobotFullSizeActivity != null) {
if (GraphFragment.mToggleButton.isChecked())
mBalancingRobotFullSizeActivity.mChatService.mBluetoothProtocol.startImu(); // Request data
else
mBalancingRobotFullSizeActivity.mChatService.mBluetoothProtocol.stopImu(); // Stop sending data
}
mHandler.postDelayed(() -> {
BalancingRobotFullSizeActivity mBalancingRobotFullSizeActivity1 = mActivity.get();
if (mBalancingRobotFullSizeActivity1 != null) {
if (GraphFragment.mToggleButton.isChecked())
mBalancingRobotFullSizeActivity1.mChatService.mBluetoothProtocol.startImu(); // Request data
else
mBalancingRobotFullSizeActivity1.mChatService.mBluetoothProtocol.stopImu(); // Stop sending data
}
}, 2000); // Wait 2 seconds before sending the message
}
Expand Down
Loading