├── .idea
├── .name
├── copyright
│ └── profiles_settings.xml
├── vcs.xml
├── modules.xml
├── gradle.xml
├── compiler.xml
└── misc.xml
├── settings.gradle
├── Screenshots
├── 7inches.png
├── App_off.png
├── App_on.png
├── appIcon.png
├── AppBanner.png
├── AppBanner.xcf
├── blueicon.xcf
├── PlayControls.png
├── blueicon_512.png
├── small_banner.png
├── App_off_thumb.png
└── device-2015-02-24.png
├── ReleaseBuild
└── BlueSound.apk
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── app
├── src
│ └── main
│ │ ├── res
│ │ ├── drawable-hdpi
│ │ │ ├── ic_audio_on.png
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_audio_off.png
│ │ ├── drawable-mdpi
│ │ │ ├── ic_audio_on.png
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_audio_off.png
│ │ ├── drawable-xhdpi
│ │ │ ├── ic_audio_off.png
│ │ │ ├── ic_audio_on.png
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xxhdpi
│ │ │ ├── ic_audio_on.png
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_audio_off.png
│ │ ├── values-v14
│ │ │ ├── dimens.xml
│ │ │ └── styles.xml
│ │ ├── layout
│ │ │ ├── control_widget.xml
│ │ │ └── activity_main.xml
│ │ ├── values-v11
│ │ │ └── styles.xml
│ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ ├── menu
│ │ │ └── main.xml
│ │ ├── xml
│ │ │ └── control_widget_info.xml
│ │ ├── values
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ ├── colors.xml
│ │ │ └── styles.xml
│ │ └── values-es
│ │ │ └── strings.xml
│ │ ├── java
│ │ └── com
│ │ │ └── soyblue
│ │ │ └── bluesound
│ │ │ ├── BlueToggleReceiver.java
│ │ │ ├── BluetoothManager.java
│ │ │ ├── BlueService.java
│ │ │ ├── ControlWidget.java
│ │ │ └── MainActivity.java
│ │ └── AndroidManifest.xml
├── build.gradle
└── app.iml
├── .gitignore
├── README.md
├── BlueSound.iml
├── LICENSE
├── gradlew.bat
├── import-summary.txt
└── gradlew
/.idea/.name:
--------------------------------------------------------------------------------
1 | BlueSound
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/Screenshots/7inches.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/Screenshots/7inches.png
--------------------------------------------------------------------------------
/Screenshots/App_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/Screenshots/App_off.png
--------------------------------------------------------------------------------
/Screenshots/App_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/Screenshots/App_on.png
--------------------------------------------------------------------------------
/Screenshots/appIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/Screenshots/appIcon.png
--------------------------------------------------------------------------------
/ReleaseBuild/BlueSound.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/ReleaseBuild/BlueSound.apk
--------------------------------------------------------------------------------
/Screenshots/AppBanner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/Screenshots/AppBanner.png
--------------------------------------------------------------------------------
/Screenshots/AppBanner.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/Screenshots/AppBanner.xcf
--------------------------------------------------------------------------------
/Screenshots/blueicon.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/Screenshots/blueicon.xcf
--------------------------------------------------------------------------------
/Screenshots/PlayControls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/Screenshots/PlayControls.png
--------------------------------------------------------------------------------
/Screenshots/blueicon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/Screenshots/blueicon_512.png
--------------------------------------------------------------------------------
/Screenshots/small_banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/Screenshots/small_banner.png
--------------------------------------------------------------------------------
/Screenshots/App_off_thumb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/Screenshots/App_off_thumb.png
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Screenshots/device-2015-02-24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/Screenshots/device-2015-02-24.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_audio_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/app/src/main/res/drawable-hdpi/ic_audio_on.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/app/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_audio_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/app/src/main/res/drawable-mdpi/ic_audio_on.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/app/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_audio_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/app/src/main/res/drawable-hdpi/ic_audio_off.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_audio_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/app/src/main/res/drawable-mdpi/ic_audio_off.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_audio_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/app/src/main/res/drawable-xhdpi/ic_audio_off.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_audio_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/app/src/main/res/drawable-xhdpi/ic_audio_on.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/app/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_audio_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/app/src/main/res/drawable-xxhdpi/ic_audio_on.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/app/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_audio_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soynerdito/BlueSound/HEAD/app/src/main/res/drawable-xxhdpi/ic_audio_off.png
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v14/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 | 0dp
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/control_widget.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 | 64dp
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/control_widget_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
11 | 8dp
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/soyblue/bluesound/BlueToggleReceiver.java:
--------------------------------------------------------------------------------
1 | package com.soyblue.bluesound;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 |
7 | public class BlueToggleReceiver extends BroadcastReceiver {
8 | public BlueToggleReceiver() {
9 | }
10 |
11 | @Override
12 | public void onReceive(Context context, Intent intent) {
13 | BluetoothManager.getInstance().toggleAudioStatus(context);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Blue Mono Sound
5 | Settings
6 | No ads just crappy mono sound redirect
7 | Cannot connect to bluetooth
8 | Play audio first then click the big button!
9 | Blue Widget
10 | Add widget
11 |
12 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 21
5 | buildToolsVersion "22.0.1"
6 |
7 | defaultConfig {
8 | applicationId "com.soyblue.bluesound"
9 | minSdkVersion 10
10 | targetSdkVersion 21
11 | }
12 |
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile 'com.android.support:appcompat-v7:21.0.3'
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/res/values-es/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sonido Mono Azul
4 | Configuracion
5 | Sin anuncios, solo baja calidad de audio mono
6 | No se pudo conectar a Bluetooth
7 | Tocar audio primero y luego presionar boton!
8 | Incluir Widget
9 | Widget Azul
10 |
11 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | #*.apk
3 | *.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 | lib/*android-support-v4.jar
11 |
12 | # Generated files
13 | bin/
14 | gen/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | #Eclise
21 | lint.xml
22 | proguard-project.txt
23 | project.properties
24 |
25 | # Local configuration file (sdk path, etc)
26 | local.properties
27 |
28 | # Proguard folder generated by Eclipse
29 | proguard/
30 |
31 | # Log Files
32 | *.log
33 |
34 | .gradle
35 | /local.properties
36 | /.idea/workspace.xml
37 | /.idea/libraries
38 | .DS_Store
39 | /build
40 |
41 | <<<<<<< HEAD
42 |
43 | =======
44 | >>>>>>> 82f1109f92708b29f863f042df1dea771856ea7a
45 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - #4CAF50
4 | - #2E7D32
5 | - #C8E6C9
6 |
7 |
8 | #4CAF50
9 | #388E3C
10 | #C8E6C9
11 | #CDDC39
12 | #212121
13 | #727272
14 | #FFFFFF
15 | #B6B6B6
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # BlueSound
2 | Android application to redirect audio to Bluetooth headset. Some Bluetooth enabled cars enable only voice to go over Bluetooth, but you may want to stream audio music. This app does just that. There are a lot of Android application in the market for this, but I failed to find one without ads so I wrote one. It is public on the Android Play store for Free to download.
3 |
4 | THIS APP IS FREE AS IN BEER!!!! No atribution, no nothing. Public Domain. Do what ever you want with it, I do not care.
5 |
6 |
7 |
9 |
10 |
11 |
12 | ScreenShots
13 |
14 |
15 | 
16 |
--------------------------------------------------------------------------------
/BlueSound.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | This is free and unencumbered software released into the public domain.
2 |
3 | Anyone is free to copy, modify, publish, use, compile, sell, or
4 | distribute this software, either in source code form or as a compiled
5 | binary, for any purpose, commercial or non-commercial, and by any
6 | means.
7 |
8 | In jurisdictions that recognize copyright laws, the author or authors
9 | of this software dedicate any and all copyright interest in the
10 | software to the public domain. We make this dedication for the benefit
11 | of the public at large and to the detriment of our heirs and
12 | successors. We intend this dedication to be an overt act of
13 | relinquishment in perpetuity of all present and future rights to this
14 | software under copyright law.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
23 |
24 | For more information, please refer to
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
39 |
40 |
41 |
44 |
45 |
46 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/soyblue/bluesound/BluetoothManager.java:
--------------------------------------------------------------------------------
1 | package com.soyblue.bluesound;
2 |
3 | import android.content.Context;
4 | import android.media.AudioManager;
5 |
6 | public final class BluetoothManager {
7 | private static BluetoothManager mInstance = null;
8 | //Remember the status of audio
9 | private boolean mAudioStatus = false;
10 |
11 | public static boolean power(boolean on) {
12 | return false;
13 | }
14 |
15 | public boolean getStatus(){
16 | return mAudioStatus;
17 | }
18 |
19 | private BluetoothManager(){
20 |
21 | }
22 |
23 | public static BluetoothManager getInstance(){
24 | if( mInstance == null ){
25 | mInstance = new BluetoothManager();
26 | }
27 | return mInstance;
28 | }
29 |
30 | public boolean streamAudioStart(Context context) {
31 | try{
32 | AudioManager localAudioManager = (AudioManager) context
33 | .getSystemService(Context.AUDIO_SERVICE);
34 | if( localAudioManager == null ){ return false; }
35 | localAudioManager.setMode(0);
36 | localAudioManager.setBluetoothScoOn(true);
37 | localAudioManager.startBluetoothSco();
38 | localAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
39 | mAudioStatus = true;
40 | }catch( Exception ex){
41 | System.out.println("Exception on Start " + ex.getMessage() );
42 | mAudioStatus = false;
43 | return false;
44 | }
45 |
46 | return mAudioStatus;
47 | }
48 |
49 | public boolean streamAudioStop(Context context) {
50 | mAudioStatus = false;
51 | AudioManager localAudioManager = (AudioManager) context
52 | .getSystemService(Context.AUDIO_SERVICE);
53 | if( localAudioManager == null ){ return false; }
54 | localAudioManager.setBluetoothScoOn(false);
55 | localAudioManager.stopBluetoothSco();
56 | localAudioManager.setMode(AudioManager.MODE_NORMAL);
57 | return true;
58 | }
59 |
60 | protected void toggleAudioStatus(Context context) {
61 | if ( getStatus()) {
62 | // Turn Audio Off
63 | streamAudioStop(context);
64 | } else {
65 | // Turn Audio ON
66 | streamAudioStart(context);
67 | }
68 |
69 | ControlWidget.requestWidgetUpdate( context );
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/app/src/main/java/com/soyblue/bluesound/BlueService.java:
--------------------------------------------------------------------------------
1 | package com.soyblue.bluesound;
2 |
3 | import android.app.IntentService;
4 | import android.content.Intent;
5 | import android.content.Context;
6 |
7 | /**
8 | * An {@link IntentService} subclass for handling asynchronous task requests in
9 | * a service on a separate handler thread.
10 | *
11 | * TODO: Customize class - update intent actions, extra parameters and static
12 | * helper methods.
13 | */
14 | public class BlueService extends IntentService {
15 | // TODO: Rename actions, choose action names that describe tasks that this
16 | // IntentService can perform, e.g. ACTION_FETCH_NEW_ITEMS
17 | private static final String STATUS_UPDATE = "com.soyblue.bluesound.action.STATUS";
18 | private static final String STATUS_ON = "com.soyblue.bluesound.extra.ON";
19 | private static final String TOGGLE = "com.soyblue.bluesound.action.TOGGLE";
20 |
21 | /**
22 | * Starts this service to perform action Foo with the given parameters. If
23 | * the service is already performing a task this action will be queued.
24 | *
25 | * @see IntentService
26 | */
27 | // TODO: Customize helper method
28 | public static void startActionFoo(Context context, String param1, String param2) {
29 | Intent intent = new Intent(context, BlueService.class);
30 | intent.setAction(STATUS_UPDATE);
31 | intent.putExtra(STATUS_ON, 1);
32 | context.startService(intent);
33 | }
34 |
35 | public static Intent getToggleIntent( Context context ){
36 | Intent intent = new Intent(context, BlueService.class);
37 | intent.setAction(TOGGLE);
38 | return intent;
39 | }
40 |
41 | public BlueService() {
42 | super("BlueService");
43 | }
44 |
45 | @Override
46 | protected void onHandleIntent(Intent intent) {
47 | if (intent != null) {
48 | final String action = intent.getAction();
49 | if (STATUS_UPDATE.equals(action)) {
50 | final boolean status = intent.getBooleanExtra(STATUS_ON, false);
51 | handleStatus(status);
52 | } else if (TOGGLE.equals(action)) {
53 | handleStatus(!BluetoothManager.getInstance().getStatus());
54 | }
55 | }
56 | }
57 |
58 | /**
59 | * Request On/Off for bluetooth streamming
60 | */
61 | private void handleStatus(boolean status) {
62 | if( status ){
63 | BluetoothManager.getInstance().streamAudioStart(getApplicationContext());
64 | }else{
65 | BluetoothManager.getInstance().streamAudioStop(getApplicationContext());
66 | }
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
19 |
20 |
23 |
24 |
33 |
34 |
42 |
43 |
52 |
53 |
61 |
62 |
63 |
74 |
75 |
--------------------------------------------------------------------------------
/app/src/main/java/com/soyblue/bluesound/ControlWidget.java:
--------------------------------------------------------------------------------
1 | package com.soyblue.bluesound;
2 |
3 | import android.app.PendingIntent;
4 | import android.appwidget.AppWidgetManager;
5 | import android.appwidget.AppWidgetProvider;
6 | import android.content.ComponentName;
7 | import android.content.Context;
8 | import android.content.Intent;
9 | import android.widget.RemoteViews;
10 |
11 |
12 | /**
13 | * Implementation of App Widget functionality.
14 | */
15 | public class ControlWidget extends AppWidgetProvider {
16 |
17 | @Override
18 | public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
19 | // There may be multiple widgets active, so update all of them
20 | final int N = appWidgetIds.length;
21 | for (int i = 0; i < N; i++) {
22 | updateAppWidget(context, appWidgetManager, appWidgetIds[i]);
23 | }
24 | }
25 |
26 |
27 | @Override
28 | public void onEnabled(Context context) {
29 | // Enter relevant functionality for when the first widget is created
30 | }
31 |
32 | @Override
33 | public void onDisabled(Context context) {
34 | // Enter relevant functionality for when the last widget is disabled
35 | }
36 |
37 | static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
38 | int appWidgetId) {
39 |
40 | // Create an Intent to launch ExampleActivity
41 | //Intent intent = BlueService.getToggleIntent(context);
42 | //PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
43 | //
44 | Intent intent = new Intent(context, BlueToggleReceiver.class);
45 | PendingIntent pendingIntent = PendingIntent.getBroadcast(context.getApplicationContext(), 234324243, intent, 0);
46 |
47 | //CharSequence widgetText = context.getString(R.string.appwidget_text);
48 | // Construct the RemoteViews object
49 | RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.control_widget);
50 | //Check if ON or if OFF
51 | if( BluetoothManager.getInstance().getStatus() ){
52 | views.setInt(R.id.widget_master, "setBackgroundResource",R.drawable.ic_audio_off );
53 | }else{
54 | views.setInt(R.id.widget_master, "setBackgroundResource",R.drawable.ic_audio_on );
55 | }
56 |
57 | views.setOnClickPendingIntent(R.id.widget_master, pendingIntent);
58 |
59 | // Instruct the widget manager to update the widget
60 | appWidgetManager.updateAppWidget(appWidgetId, views);
61 |
62 | }
63 |
64 | @Override
65 | public void onReceive(Context context, Intent intent) {
66 | super.onReceive(context, intent);
67 | if( AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(intent.getAction()) ){
68 | //Request update of all views
69 | int ids[] = AppWidgetManager.getInstance(context).getAppWidgetIds(new ComponentName(context, ControlWidget.class));
70 | final int N = ids.length;
71 | for (int i = 0; i < N; i++) {
72 | updateAppWidget(context, AppWidgetManager.getInstance(context), ids[i]);
73 | }
74 | }
75 | }
76 |
77 | public static void requestWidgetUpdate(Context context ){
78 | Intent brIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
79 | context.getApplicationContext().sendBroadcast(brIntent);
80 |
81 | }
82 | }
83 |
84 |
--------------------------------------------------------------------------------
/import-summary.txt:
--------------------------------------------------------------------------------
1 | ECLIPSE ANDROID PROJECT IMPORT SUMMARY
2 | ======================================
3 |
4 | Manifest Merging:
5 | -----------------
6 | Your project uses libraries that provide manifests, and your Eclipse
7 | project did not explicitly turn on manifest merging. In Android Gradle
8 | projects, manifests are always merged (meaning that contents from your
9 | libraries' manifests will be merged into the app manifest. If you had
10 | manually copied contents from library manifests into your app manifest
11 | you may need to remove these for the app to build correctly.
12 |
13 | Ignored Files:
14 | --------------
15 | The following files were *not* copied into the new Gradle project; you
16 | should evaluate whether these are still needed in your project and if
17 | so manually move them:
18 |
19 | * .gitignore
20 | * LICENSE
21 | * README.md
22 | * ReleaseBuild/
23 | * ReleaseBuild/BlueSound.apk
24 | * Screenshots/
25 | * Screenshots/7inches.png
26 | * Screenshots/AppBanner.png
27 | * Screenshots/AppBanner.xcf
28 | * Screenshots/App_off.png
29 | * Screenshots/App_off_thumb.png
30 | * Screenshots/App_on.png
31 | * Screenshots/PlayControls.png
32 | * Screenshots/appIcon.png
33 | * Screenshots/blueicon.xcf
34 | * Screenshots/blueicon_512.png
35 | * Screenshots/device-2015-02-24.png
36 | * Screenshots/small_banner.png
37 | * ic_audio_off-web.png
38 | * ic_audio_on-web.png
39 | * ic_launcher-web.png
40 | * proguard-project.txt
41 |
42 | Replaced Jars with Dependencies:
43 | --------------------------------
44 | The importer recognized the following .jar files as third party
45 | libraries and replaced them with Gradle dependencies instead. This has
46 | the advantage that more explicit version information is known, and the
47 | libraries can be updated automatically. However, it is possible that
48 | the .jar file in your project was of an older version than the
49 | dependency we picked, which could render the project not compileable.
50 | You can disable the jar replacement in the import wizard and try again:
51 |
52 | android-support-v4.jar => com.android.support:support-v4:21.0.3
53 | android-support-v7-appcompat.jar => com.android.support:appcompat-v7:21.0.3
54 |
55 | Replaced Libraries with Dependencies:
56 | -------------------------------------
57 | The importer recognized the following library projects as third party
58 | libraries and replaced them with Gradle dependencies instead. This has
59 | the advantage that more explicit version information is known, and the
60 | libraries can be updated automatically. However, it is possible that
61 | the source files in your project were of an older version than the
62 | dependency we picked, which could render the project not compileable.
63 | You can disable the library replacement in the import wizard and try
64 | again:
65 |
66 | android-support-v7-appcompat => [com.android.support:appcompat-v7:21.0.3]
67 |
68 | Moved Files:
69 | ------------
70 | Android Gradle projects use a different directory structure than ADT
71 | Eclipse projects. Here's how the projects were restructured:
72 |
73 | * AndroidManifest.xml => app/src/main/AndroidManifest.xml
74 | * assets/ => app/src/main/assets/
75 | * lint.xml => app/lint.xml
76 | * res/ => app/src/main/res/
77 | * src/ => app/src/main/java/
78 |
79 | Next Steps:
80 | -----------
81 | You can now build the project. The Gradle project needs network
82 | connectivity to download dependencies.
83 |
84 | Bugs:
85 | -----
86 | If for some reason your project does not build, and you determine that
87 | it is due to a bug or limitation of the Eclipse to Gradle importer,
88 | please file a bug at http://b.android.com with category
89 | Component-Tools.
90 |
91 | (This import summary is for your information only, and can be deleted
92 | after import once you are satisfied with the results.)
93 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/app/src/main/java/com/soyblue/bluesound/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.soyblue.bluesound;
2 |
3 | import java.util.concurrent.Executors;
4 | import java.util.concurrent.ScheduledExecutorService;
5 | import java.util.concurrent.TimeUnit;
6 |
7 | import android.annotation.SuppressLint;
8 | import android.bluetooth.BluetoothAdapter;
9 | import android.bluetooth.BluetoothDevice;
10 | import android.content.BroadcastReceiver;
11 | import android.content.Context;
12 | import android.content.Intent;
13 | import android.content.IntentFilter;
14 | import android.graphics.drawable.Drawable;
15 | import android.os.Bundle;
16 | import android.os.Handler;
17 | import android.support.v7.app.ActionBarActivity;
18 | import android.view.KeyEvent;
19 | import android.view.View;
20 | import android.widget.Toast;
21 |
22 | public class MainActivity extends ActionBarActivity {
23 |
24 | private final String AUDIO_STATUS = "AUDIO_STATUS";
25 | final Handler mguiHandler = new Handler();
26 |
27 | // The BroadcastReceiver that listens for Bluetooth broadcasts
28 | private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
29 | @Override
30 | public void onReceive(Context context, Intent intent) {
31 | String action = intent.getAction();
32 | // BluetoothDevice device =
33 | // intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
34 |
35 | if (BluetoothDevice.ACTION_FOUND.equals(action)) {
36 | // Device found
37 | } else if (BluetoothManager.getInstance().getStatus()
38 | && BluetoothDevice.ACTION_ACL_CONNECTED.equals(action)) {
39 | // Device is now connected
40 | refreshButtonImage();
41 | } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED
42 | .equals(action)) {
43 | // Done searching
44 | } else if (BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED
45 | .equals(action)) {
46 | // Device is about to disconnect
47 | } else if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) {
48 | // Device has disconnected
49 | stopAudio();
50 | refreshButtonImage();
51 | }
52 | }
53 | };
54 |
55 | @Override
56 | protected void onCreate(Bundle savedInstanceState) {
57 | super.onCreate(savedInstanceState);
58 | setContentView(R.layout.activity_main);
59 |
60 | refreshButtonImage();
61 |
62 | // Register Intent Filter to identify when bluetooth device is
63 | // disconnected
64 | IntentFilter filter = new IntentFilter();
65 | filter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
66 | filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED);
67 | filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
68 | filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
69 | filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
70 | filter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
71 | filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
72 |
73 | registerReceiver(mReceiver, filter);
74 |
75 | }
76 |
77 | private void refreshButtonImage() {
78 | refreshButtonImage(findViewById(R.id.btnAudioON));
79 | }
80 |
81 | @SuppressLint("NewApi")
82 | @SuppressWarnings("deprecation")
83 | private void refreshButtonImage(View view) {
84 |
85 | int sdk = android.os.Build.VERSION.SDK_INT;
86 | if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
87 | Drawable background = getResources().getDrawable(
88 | (BluetoothManager.getInstance().getStatus() ? R.drawable.ic_audio_off
89 | : R.drawable.ic_audio_on));
90 | view.setBackgroundDrawable(background);
91 | } else {
92 | view.setBackground(getResources().getDrawable(
93 | (BluetoothManager.getInstance().getStatus() ? R.drawable.ic_audio_off
94 | : R.drawable.ic_audio_on)));
95 | }
96 | //Update App Widget
97 | ControlWidget.requestWidgetUpdate(getApplicationContext());
98 | }
99 |
100 | protected void stopAudio() {
101 | BluetoothManager.getInstance().streamAudioStop(getApplicationContext());
102 | }
103 |
104 | protected void startAudio() {
105 | BluetoothManager.getInstance().streamAudioStart(getApplicationContext());
106 | // mAudioON = true;
107 | if (!BluetoothManager.getInstance().getStatus()) {
108 | Toast.makeText(this, R.string.cannot_connect, Toast.LENGTH_SHORT)
109 | .show();
110 | }
111 | }
112 |
113 |
114 |
115 | private static final ScheduledExecutorService worker = Executors
116 | .newSingleThreadScheduledExecutor();
117 |
118 |
119 | private void delayAudioStart() {
120 | Runnable task = new Runnable() {
121 | public void run() {
122 | startAudio();
123 |
124 | // Refresh UI
125 | mguiHandler.post(new Runnable() {
126 | public void run() {
127 | refreshButtonImage();
128 | }
129 | });
130 | }
131 | };
132 | worker.schedule(task, 250, TimeUnit.MILLISECONDS);
133 | }
134 |
135 | private void broadcastKey(int key, boolean restartAudio) {
136 | if (restartAudio) {
137 | stopAudio();
138 | }
139 | Intent mbIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
140 | // KeyEvent
141 | KeyEvent keyEvent = new KeyEvent(KeyEvent.ACTION_DOWN, key);
142 | // mbIntent
143 | mbIntent.putExtra(Intent.EXTRA_KEY_EVENT, keyEvent);
144 | sendBroadcast(mbIntent);
145 |
146 | if (restartAudio) {
147 | delayAudioStart();
148 | }
149 | }
150 |
151 | public void onSoundStop(View view) {
152 | broadcastKey(KeyEvent.KEYCODE_MEDIA_PAUSE, false);
153 | }
154 |
155 | public void onSoundPlay(View view) {
156 | broadcastKey(KeyEvent.KEYCODE_MEDIA_PLAY, true);
157 | }
158 |
159 | public void onSoundBack(View view) {
160 | broadcastKey(KeyEvent.KEYCODE_MEDIA_PREVIOUS, true);
161 | }
162 |
163 | public void onSoundNext(View view) {
164 | broadcastKey(KeyEvent.KEYCODE_MEDIA_NEXT, true);
165 | }
166 |
167 | public void onStreamClick(View view) {
168 | BluetoothManager.getInstance().toggleAudioStatus( getApplicationContext() );
169 | refreshButtonImage(view);
170 | }
171 |
172 | @Override
173 | protected void onSaveInstanceState(Bundle outState) {
174 | outState.putBoolean(AUDIO_STATUS, BluetoothManager.getInstance().getStatus());
175 | super.onSaveInstanceState(outState);
176 | }
177 |
178 | }
179 |
--------------------------------------------------------------------------------
/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------