Skip to content

Fix bug when manifest is merged. #3

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

Open
wants to merge 1 commit 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 app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ repositories {
}

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

defaultConfig {
applicationId "io.palaima.smoothbluetooth.app"
minSdkVersion 15
targetSdkVersion 22
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
versionCode 1
versionName "1.0"
}
Expand All @@ -26,10 +26,8 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:recyclerview-v7:22.0.0'
compile 'com.afollestad:material-dialogs:0.6.2.1'
//compile project (':library')
compile 'io.palaima:smoothbluetooth:0.1.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile project(':library')
//compile 'io.palaima:smoothbluetooth:0.1.0'
}
54 changes: 23 additions & 31 deletions app/src/main/java/io/palaima/smoothbluetooth/app/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package io.palaima.smoothbluetooth.app;

import com.afollestad.materialdialogs.MaterialDialog;
import com.palaima.bluetooth.app.R;

import android.bluetooth.BluetoothAdapter;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
Expand All @@ -21,11 +19,13 @@
import android.widget.TextView;
import android.widget.Toast;

import com.palaima.bluetooth.app.R;

import java.util.ArrayList;
import java.util.List;

import io.palaima.smoothbluetooth.SmoothBluetooth;
import io.palaima.smoothbluetooth.Device;
import io.palaima.smoothbluetooth.SmoothBluetooth;


public class MainActivity extends AppCompatActivity {
Expand Down Expand Up @@ -68,7 +68,7 @@ protected void onCreate(Bundle savedInstanceState) {
mSmoothBluetooth.setListener(mListener);

ListView responseListView = (ListView) findViewById(R.id.responses);
mResponsesAdapter = new ArrayAdapter<>( this, android.R.layout.simple_list_item_1, mResponseBuffer);
mResponsesAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, mResponseBuffer);
responseListView.setAdapter(mResponsesAdapter);

mCRLFBox = (CheckBox) findViewById(R.id.carrage);
Expand Down Expand Up @@ -147,8 +147,8 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == ENABLE_BT__REQUEST) {
if(resultCode == RESULT_OK) {
if (requestCode == ENABLE_BT__REQUEST) {
if (resultCode == RESULT_OK) {
mSmoothBluetooth.tryConnection();
}
}
Expand Down Expand Up @@ -216,37 +216,29 @@ public void onNoDevicesFound() {

@Override
public void onDevicesFound(final List<Device> deviceList,
final SmoothBluetooth.ConnectionCallback connectionCallback) {

final MaterialDialog dialog = new MaterialDialog.Builder(MainActivity.this)
.title("Devices")
.adapter(new DevicesAdapter(MainActivity.this, deviceList))
.build();

ListView listView = dialog.getListView();
if (listView != null) {
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
connectionCallback.connectTo(deviceList.get(position));
dialog.dismiss();
}

});
}

dialog.show();

final SmoothBluetooth.ConnectionCallback connectionCallback) {

new AlertDialog.Builder(MainActivity.this)
.setTitle("Device")
.setAdapter(new DevicesAdapter(MainActivity.this, deviceList),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
connectionCallback.connectTo(deviceList.get(which));
}
})
.create()
.show();
}

@Override
public void onDataReceived(int data) {
mBuffer.add(data);
if (data == 62 && !mBuffer.isEmpty()) {
//if (data == 0x0D && !mBuffer.isEmpty() && mBuffer.get(mBuffer.size()-2) == 0xA0) {
//if (data == 0x0D && !mBuffer.isEmpty() && mBuffer.get(mBuffer.size()-2) == 0xA0) {
StringBuilder sb = new StringBuilder();
for (int integer : mBuffer) {
sb.append((char)integer);
sb.append((char) integer);
}
mBuffer.clear();
mResponseBuffer.add(0, sb.toString());
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.android.tools.build:gradle:1.5.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ VERSION_NAME=0.2.0-SNAPSHOT
VERSION_CODE=2
GROUP=io.palaima

ANDROID_BUILD_TARGET_SDK_VERSION=23
ANDROID_BUILD_SDK_VERSION=23
ANDROID_BUILD_TOOLS_VERSION=23.0.2

POM_DESCRIPTION= An Android library made smooth for your bluetooth communication.
POM_URL=https://github.com/palaima/AndroidSmoothBluetooth
POM_SCM_URL=https://github.com/palaima/AndroidSmoothBluetooth
Expand Down
8 changes: 3 additions & 5 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

defaultConfig {
minSdkVersion 10
targetSdkVersion 22
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
versionCode 1
versionName "0.1.0"
}
Expand All @@ -19,8 +19,6 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
}

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
8 changes: 2 additions & 6 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.palaima.bluetoothmanager">

<application android:allowBackup="true"
android:label="@string/app_name"
>

</application>

<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
</manifest>
3 changes: 0 additions & 3 deletions library/src/main/res/values/strings.xml

This file was deleted.