Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/fix connection #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
16 changes: 7 additions & 9 deletions Software/Android/RoboRoach/build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
compileSdkVersion 29
defaultConfig {
applicationId 'com.backyardbrains.roboroach'
minSdkVersion 18
targetSdkVersion 27
versionCode 5
versionName "1.2"
targetSdkVersion 29
versionCode 6
versionName "1.3"
}
}

ext {
supportLibraryVersion = '27.0.2'
easyPermissionsVersion = '1.1.3'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// support library
implementation "com.android.support:support-compat:$supportLibraryVersion"
// androidx library
implementation 'androidx.core:core:1.3.2'
// permissions
implementation "pub.devrel:easypermissions:$easyPermissionsVersion"
implementation 'com.android.support:design:27.0.2'
implementation 'com.google.android.material:material:1.3.0'
}
1 change: 1 addition & 0 deletions Software/Android/RoboRoach/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.Menu;
Expand All @@ -25,8 +22,15 @@
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ViewFlipper;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import com.backyardbrains.roboroach.utils.BluetoothUtils;

import java.util.List;

import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.AppSettingsDialog;
import pub.devrel.easypermissions.EasyPermissions;
Expand Down Expand Up @@ -567,10 +571,10 @@ private void bleMissing() {
}

@AfterPermissionGranted(REQUEST_CODE_ACCESS_COARSE_LOCATION_PERM) void checkLocation() {
if (!EasyPermissions.hasPermissions(this, Manifest.permission.ACCESS_COARSE_LOCATION)) {
if (!EasyPermissions.hasPermissions(this, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION)) {
// Request the permission
EasyPermissions.requestPermissions(this, getString(R.string.rationale_access_coarse_location),
REQUEST_CODE_ACCESS_COARSE_LOCATION_PERM, Manifest.permission.ACCESS_COARSE_LOCATION);
REQUEST_CODE_ACCESS_COARSE_LOCATION_PERM, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import android.bluetooth.BluetoothManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;

import androidx.annotation.NonNull;

/**
* @author Tihomir Leka <ticapeca at gmail.com.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.design.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="140dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/app_name"
android:textSize="22sp"
app:fontFamily="@font/comic_book"/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
app:fontFamily="@font/comic_book" />
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>

<ViewFlipper
android:id="@+id/viewFlipper"
Expand All @@ -38,10 +38,10 @@
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.backyardbrains.roboroach.RoboRoachActivity"
tools:ignore="MergeRootFrame">

Expand All @@ -51,7 +51,7 @@
android:layout_height="306dp"
android:layout_gravity="center"
android:src="@drawable/roach"
tools:ignore="ContentDescription"/>
tools:ignore="ContentDescription" />

<ImageView
android:id="@+id/imageBackpack"
Expand All @@ -61,41 +61,41 @@
android:layout_marginTop="20dp"
android:src="@drawable/backpack"
android:visibility="invisible"
tools:ignore="ContentDescription"/>
tools:ignore="ContentDescription" />

<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/textGoLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:text="@string/rr_goleft"
android:textAppearance="?android:attr/textAppearanceLarge"
app:fontFamily="@font/comic_book"/>
app:fontFamily="@font/comic_book" />

<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/textGoRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:text="@string/rr_goright"
android:textAppearance="?android:attr/textAppearanceLarge"
app:fontFamily="@font/comic_book"/>
app:fontFamily="@font/comic_book" />

<android.support.v7.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/textConfig"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:textAppearance="?android:attr/textAppearanceSmall"
app:fontFamily="@font/comic_book"
tools:text="RoboRoach configuration text"/>
tools:text="RoboRoach configuration text" />
</FrameLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
android:baselineAligned="false"
android:orientation="horizontal">

<RelativeLayout
android:layout_width="match_parent"
Expand All @@ -120,13 +120,13 @@
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:text="Gain"
android:textAppearance="?android:attr/textAppearanceSmall"/>
android:textAppearance="?android:attr/textAppearanceSmall" />

<SeekBar
android:id="@+id/sbGain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
android:layout_weight="1" />
</TableRow>

<TableRow
Expand All @@ -140,13 +140,13 @@
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:text="Duration"
android:textAppearance="?android:attr/textAppearanceSmall"/>
android:textAppearance="?android:attr/textAppearanceSmall" />

<SeekBar
android:id="@+id/sbDuration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
android:layout_weight="1" />
</TableRow>

<TableRow
Expand All @@ -159,7 +159,7 @@
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Random Mode"
android:textAppearance="?android:attr/textAppearanceSmall"/>
android:textAppearance="?android:attr/textAppearanceSmall" />
</TableRow>

<TableRow
Expand All @@ -173,13 +173,13 @@
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:text="Frequency"
android:textAppearance="?android:attr/textAppearanceSmall"/>
android:textAppearance="?android:attr/textAppearanceSmall" />

<SeekBar
android:id="@+id/sbFrequency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
android:layout_weight="1" />
</TableRow>

<TableRow
Expand All @@ -193,13 +193,13 @@
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:text="Pulse Width"
android:textAppearance="?android:attr/textAppearanceSmall"/>
android:textAppearance="?android:attr/textAppearanceSmall" />

<SeekBar
android:id="@+id/sbPulseWidth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
android:layout_weight="1" />
</TableRow>

<TableRow
Expand All @@ -212,7 +212,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:text="OK"/>
android:text="OK" />
</TableRow>
</LinearLayout>
</RelativeLayout>
Expand All @@ -226,7 +226,7 @@
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="150dp"
tools:ignore="ContentDescription"/>
tools:ignore="ContentDescription" />
</RelativeLayout>
</LinearLayout>
</ViewFlipper>
Expand Down
Loading