diff --git a/KristoRadioPlayer/.gitignore b/KristoRadioPlayer/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..39fb081a42a86ccf8f9cf99dbccc8bdf7c828bce --- /dev/null +++ b/KristoRadioPlayer/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/KristoRadioPlayer/.idea/compiler.xml b/KristoRadioPlayer/.idea/compiler.xml new file mode 100644 index 0000000000000000000000000000000000000000..96cc43efa6a0885098044e976cd780bb42c68a70 --- /dev/null +++ b/KristoRadioPlayer/.idea/compiler.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="CompilerConfiguration"> + <resourceExtensions /> + <wildcardResourcePatterns> + <entry name="!?*.java" /> + <entry name="!?*.form" /> + <entry name="!?*.class" /> + <entry name="!?*.groovy" /> + <entry name="!?*.scala" /> + <entry name="!?*.flex" /> + <entry name="!?*.kt" /> + <entry name="!?*.clj" /> + <entry name="!?*.aj" /> + </wildcardResourcePatterns> + <annotationProcessing> + <profile default="true" name="Default" enabled="false"> + <processorPath useClasspath="true" /> + </profile> + </annotationProcessing> + </component> +</project> \ No newline at end of file diff --git a/KristoRadioPlayer/.idea/copyright/profiles_settings.xml b/KristoRadioPlayer/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..e7bedf3377d40335424fd605124d4761390218bb --- /dev/null +++ b/KristoRadioPlayer/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ +<component name="CopyrightManager"> + <settings default="" /> +</component> \ No newline at end of file diff --git a/KristoRadioPlayer/.idea/gradle.xml b/KristoRadioPlayer/.idea/gradle.xml new file mode 100644 index 0000000000000000000000000000000000000000..bc3eb86f2f00500ecbca24b3614ce7bb4209b915 --- /dev/null +++ b/KristoRadioPlayer/.idea/gradle.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="GradleSettings"> + <option name="linkedExternalProjectsSettings"> + <GradleProjectSettings> + <option name="distributionType" value="DEFAULT_WRAPPED" /> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="modules"> + <set> + <option value="$PROJECT_DIR$" /> + <option value="$PROJECT_DIR$/app" /> + <option value="$PROJECT_DIR$/volley" /> + </set> + </option> + <option name="resolveModulePerSourceSet" value="false" /> + </GradleProjectSettings> + </option> + </component> +</project> \ No newline at end of file diff --git a/KristoRadioPlayer/.idea/misc.xml b/KristoRadioPlayer/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..ba7052b8197ddf8ba8756022d905d03055c7ad60 --- /dev/null +++ b/KristoRadioPlayer/.idea/misc.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="NullableNotNullManager"> + <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> + <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> + <option name="myNullables"> + <value> + <list size="4"> + <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> + <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> + <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> + <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> + </list> + </value> + </option> + <option name="myNotNulls"> + <value> + <list size="4"> + <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> + <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> + <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> + <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> + </list> + </value> + </option> + </component> + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> + <output url="file://$PROJECT_DIR$/build/classes" /> + </component> + <component name="ProjectType"> + <option name="id" value="Android" /> + </component> +</project> \ No newline at end of file diff --git a/KristoRadioPlayer/.idea/modules.xml b/KristoRadioPlayer/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..a8ea7f0db070204ce1979372484ed2a1b9c47f0a --- /dev/null +++ b/KristoRadioPlayer/.idea/modules.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/KristoRadioPlayer.iml" filepath="$PROJECT_DIR$/KristoRadioPlayer.iml" /> + <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> + <module fileurl="file://$PROJECT_DIR$/volley/volley.iml" filepath="$PROJECT_DIR$/volley/volley.iml" /> + </modules> + </component> +</project> \ No newline at end of file diff --git a/KristoRadioPlayer/.idea/runConfigurations.xml b/KristoRadioPlayer/.idea/runConfigurations.xml new file mode 100644 index 0000000000000000000000000000000000000000..7f68460d8b38ac04e3a3224d7c79ef719b1991a9 --- /dev/null +++ b/KristoRadioPlayer/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="RunConfigurationProducerService"> + <option name="ignoredProducers"> + <set> + <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" /> + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" /> + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" /> + </set> + </option> + </component> +</project> \ No newline at end of file diff --git a/KristoRadioPlayer/.idea/vcs.xml b/KristoRadioPlayer/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..f42e9a56e79ff2037cabb7d6cf025e3f16fbe01f --- /dev/null +++ b/KristoRadioPlayer/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$/volley" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/KristoRadioPlayer/app/.gitignore b/KristoRadioPlayer/app/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..796b96d1c402326528b4ba3c12ee9d92d0e212e9 --- /dev/null +++ b/KristoRadioPlayer/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/KristoRadioPlayer/app/build.gradle b/KristoRadioPlayer/app/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..9c6e048804100934b7512a52022808ac6eb428c4 --- /dev/null +++ b/KristoRadioPlayer/app/build.gradle @@ -0,0 +1,31 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 26 + buildToolsVersion "26.0.2" + defaultConfig { + applicationId "com.example.kristo.kristoradioplayer" + minSdkVersion 19 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:26.+' + compile 'com.android.support.constraint:constraint-layout:1.0.2' + testCompile 'junit:junit:4.12' + compile 'com.android.volley:volley:1.0.0' +} diff --git a/KristoRadioPlayer/app/proguard-rules.pro b/KristoRadioPlayer/app/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..50a0cd027f5eb985d7ee383e11ee1ef436edef98 --- /dev/null +++ b/KristoRadioPlayer/app/proguard-rules.pro @@ -0,0 +1,25 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\Kristo\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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/KristoRadioPlayer/app/src/androidTest/java/com/example/kristo/kristoradioplayer/ExampleInstrumentedTest.java b/KristoRadioPlayer/app/src/androidTest/java/com/example/kristo/kristoradioplayer/ExampleInstrumentedTest.java new file mode 100644 index 0000000000000000000000000000000000000000..89467207114e531f45ff481861459356fea5c70d --- /dev/null +++ b/KristoRadioPlayer/app/src/androidTest/java/com/example/kristo/kristoradioplayer/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.kristo.kristoradioplayer; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.example.kristo.kristoradioplayer", appContext.getPackageName()); + } +} diff --git a/KristoRadioPlayer/app/src/main/AndroidManifest.xml b/KristoRadioPlayer/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..a4f10cc86d90d06c3ccab9da0e8149c1211788c9 --- /dev/null +++ b/KristoRadioPlayer/app/src/main/AndroidManifest.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.kristo.kristoradioplayer"> + + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.READ_PHONE_STATE" /> + <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/> + <application + android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:theme="@style/AppTheme"> + + <activity android:name=".MainActivity"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <service android:name=".BackgroundMusicService"> + <intent-filter> + <action android:name="android.intent.action.PHONE_STATE"/> + </intent-filter> + </service> + </application> + +</manifest> \ No newline at end of file diff --git a/KristoRadioPlayer/app/src/main/java/com/example/kristo/kristoradioplayer/BackgroundMusicService.java b/KristoRadioPlayer/app/src/main/java/com/example/kristo/kristoradioplayer/BackgroundMusicService.java new file mode 100644 index 0000000000000000000000000000000000000000..e5f55fcb799eca73e1f3e2797b0e71c2085c3dc9 --- /dev/null +++ b/KristoRadioPlayer/app/src/main/java/com/example/kristo/kristoradioplayer/BackgroundMusicService.java @@ -0,0 +1,244 @@ +package com.example.kristo.kristoradioplayer; + +import android.app.Service; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.media.AudioManager; +import android.media.MediaPlayer; +import android.os.AsyncTask; +import android.os.IBinder; +import android.support.annotation.Nullable; +import android.support.v4.content.LocalBroadcastManager; +import android.telephony.PhoneStateListener; +import android.telephony.TelephonyManager; +import android.util.Log; + +import com.android.volley.Request; +import com.android.volley.RequestQueue; +import com.android.volley.Response; +import com.android.volley.VolleyError; +import com.android.volley.toolbox.JsonObjectRequest; +import com.android.volley.toolbox.Volley; + +import org.json.JSONArray; +import org.json.JSONObject; + +import java.io.IOException; +import java.util.Date; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +/** + * Created by Kristo on 10/11/2017. + */ + +public class BackgroundMusicService extends Service implements MediaPlayer.OnErrorListener, MediaPlayer.OnCompletionListener, MediaPlayer.OnPreparedListener, MediaPlayer.OnInfoListener { + + private static final String TAG = BackgroundMusicService.class.getSimpleName(); + RequestQueue requestQueue; + String url = "http://dad.akaver.com/api/songtitles/SP"; + String artist; + String songTitle; + private MediaPlayer mediaPlayer; + private String streamUrl; + private ScheduledExecutorService scheduleTaskExecutor; + private BroadcastReceiver mBroadcastReceiver; + TelephonyManager telephonyManager; + PhoneStateListener phoneStateListener; + boolean onCall = false; + + @Override + public int onStartCommand(Intent intent, int flags, final int startId) { + Log.v(TAG, "onStartCommand"); + + if (mediaPlayer != null) { + mediaPlayer.release(); + mediaPlayer = null; + } + + mediaPlayer = new MediaPlayer(); + mediaPlayer.reset(); + mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); + mediaPlayer.setOnErrorListener(this); + mediaPlayer.setOnPreparedListener(this); + mediaPlayer.setOnCompletionListener(this); + mediaPlayer.setOnInfoListener(this); + + try { + streamUrl = intent.getStringExtra("streamUrl"); + mediaPlayer.setDataSource(streamUrl); + } catch (IOException e) { + e.printStackTrace(); + } + + startMediaPlayer(); + startArtistInfo(); + phoneCallManager(); + + mBroadcastReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + Log.v(TAG, "mBroadcastReceiver.stopPlayer - broadcast"); + if (intent.getAction().equals(Constants.PLAYER_INTENT_STATUS_STOP_PLAYER)) { + stopMediaPlayer(); + } + } + }; + + IntentFilter intentFilter = new IntentFilter(); + intentFilter.addAction(Constants.PLAYER_INTENT_STATUS_STOP_PLAYER); + + LocalBroadcastManager.getInstance(this).registerReceiver(mBroadcastReceiver, intentFilter); + + + return Service.START_REDELIVER_INTENT; + } + + private void phoneCallManager() { + telephonyManager = (TelephonyManager) getSystemService(getBaseContext().TELEPHONY_SERVICE); + + phoneStateListener = new PhoneStateListener() { + @Override + public void onCallStateChanged(int state, String incomingNumber) { + switch (state) { + + case TelephonyManager.CALL_STATE_RINGING: + Log.v(TAG, "Phone ringing, need to stop playback"); + onCall = true; + if (mediaPlayer.isPlaying()) { + mediaPlayer.stop(); + } + break; + + case TelephonyManager.CALL_STATE_OFFHOOK: + Log.v(TAG, "Phone offhook, need to stop playback"); + onCall = true; + mediaPlayer.stop(); + break; + + case TelephonyManager.CALL_STATE_IDLE: + Log.v(TAG, "Phone now idle, resuming playing"); + if (onCall) { + mediaPlayer.prepareAsync(); + } + onCall = false; + break; + } + } + }; + + telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); + } + + private void startArtistInfo() { + scheduleTaskExecutor = Executors.newScheduledThreadPool(5); + scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() { + + @Override + public void run() { + new getArtistInfo().execute(); + + } + }, 0, 15, TimeUnit.SECONDS); + } + + private void startMediaPlayer() { + Intent intent = new Intent(Constants.PLAYER_INTENT_STATUS_BUFFERING); + LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent); + mediaPlayer.prepareAsync(); + } + + private void stopMediaPlayer() { + + Intent intent = new Intent(Constants.PLAYER_INTENT_STATUS_STOPPED); + LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent); + + try { + mediaPlayer.stop(); + mediaPlayer.reset(); + mediaPlayer.release(); + LocalBroadcastManager.getInstance(this).unregisterReceiver(mBroadcastReceiver); + scheduleTaskExecutor.shutdownNow(); + if (phoneStateListener != null) { + telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE); + } + Log.v(TAG,"onStopMediaPlayer"); + stopSelf(); + + } catch (Exception e) { + e.printStackTrace(); + } + + } + + @Nullable + @Override + public IBinder onBind(Intent intent) { + Log.v(TAG, "IBinder"); + return null; + } + + @Override + public boolean onError(MediaPlayer mediaPlayer, int i, int i1) { + return false; + } + + @Override + public void onCompletion(MediaPlayer mediaPlayer) { + } + + @Override + public void onPrepared(MediaPlayer mediaPlayer) { + + Intent intent = new Intent(Constants.PLAYER_INTENT_STATUS_PLAYING); + LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent); + mediaPlayer.start(); + } + + @Override + public boolean onInfo(MediaPlayer mediaPlayer, int i, int i1) { + return false; + } + + private class getArtistInfo extends AsyncTask<Void, Void, Void> { + + @Override + protected Void doInBackground(Void... params) { + + requestQueue = Volley.newRequestQueue(getBaseContext()); + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url, null, + new Response.Listener<JSONObject>() { + @Override + public void onResponse(JSONObject response) { + try { + JSONArray jsonArray = response.getJSONArray("SongHistoryList"); + JSONObject songInfoObject = jsonArray.getJSONObject(0); + artist = songInfoObject.getString("Artist"); + songTitle = songInfoObject.getString("Title"); + Intent intent = new Intent(Constants.PLAYER_INTENT_STATUS_TEST); + intent.putExtra(Constants.PLAYER_INTENT_STATUS_ARTIST_NAME, artist); + intent.putExtra(Constants.PLAYER_INTENT_STATUS_SONG_TITLE, songTitle); + LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent); + + } catch (Exception e) { + Log.v(TAG, "JSON array error" + e.toString()); + } + } + }, + new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + Log.v(TAG, "Volley error"); + } + } + ); + requestQueue.add(jsonObjectRequest); + + return null; + } + } + +} diff --git a/KristoRadioPlayer/app/src/main/java/com/example/kristo/kristoradioplayer/Constants.java b/KristoRadioPlayer/app/src/main/java/com/example/kristo/kristoradioplayer/Constants.java new file mode 100644 index 0000000000000000000000000000000000000000..f311426730e40fa86325ddda88cadf7b942589f5 --- /dev/null +++ b/KristoRadioPlayer/app/src/main/java/com/example/kristo/kristoradioplayer/Constants.java @@ -0,0 +1,18 @@ +package com.example.kristo.kristoradioplayer; + + +public class Constants { + public static final int PLAYER_STATUS_STOPPED = 0; + public static final int PLAYER_STATUS_BUFFERING = 1; + public static final int PLAYER_STATUS_PLAYING = 2; + + public static final String PLAYER_INTENT_STATUS_STOPPED = "com.example.kristo.player-status-stopped"; + public static final String PLAYER_INTENT_STATUS_BUFFERING = "com.example.kristo.player-status-buffering"; + public static final String PLAYER_INTENT_STATUS_PLAYING = "com.example.kristo.player-status-playing"; + public static final String PLAYER_INTENT_STATUS_TEST = "com.example.kristo.player-status-test"; + + public static final String PLAYER_INTENT_STATUS_STOP_PLAYER = "com.example.kristo.player-status-stop-player"; + + public static final String PLAYER_INTENT_STATUS_ARTIST_NAME = "com.example.kristo.player-status-artist-name"; + public static final String PLAYER_INTENT_STATUS_SONG_TITLE = "com.example.kristo.player-status-song-title"; +} diff --git a/KristoRadioPlayer/app/src/main/java/com/example/kristo/kristoradioplayer/MainActivity.java b/KristoRadioPlayer/app/src/main/java/com/example/kristo/kristoradioplayer/MainActivity.java new file mode 100644 index 0000000000000000000000000000000000000000..e677968d09f1a0b2adda7f42ca439b3e1f6dca9c --- /dev/null +++ b/KristoRadioPlayer/app/src/main/java/com/example/kristo/kristoradioplayer/MainActivity.java @@ -0,0 +1,169 @@ +package com.example.kristo.kristoradioplayer; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.media.AudioManager; +import android.support.v4.content.LocalBroadcastManager; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.SeekBar; +import android.widget.TextView; + +public class MainActivity extends AppCompatActivity { + + private static final String TAG = MainActivity.class.getSimpleName(); + + private Button mButton; + private TextView mTextViewPlayerStatus; + private TextView mSongTitle; + private int mPlayerStatus = Constants.PLAYER_STATUS_STOPPED; + private BroadcastReceiver mBroadcastReceiver; + private AudioManager audioManager; + private SeekBar seekBarVolume; + + @Override + protected void onCreate(Bundle savedInstanceState) { + Log.v(TAG, "OnCreate"); + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + setVolumeControlStream(AudioManager.STREAM_MUSIC); + audioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE); + + setSeekBar(); + + mButton = (Button) findViewById(R.id.buttonPlayStop); + mTextViewPlayerStatus = (TextView) findViewById(R.id.textViewPlayerStatus); + mSongTitle = (TextView) findViewById(R.id.songTitle); + mBroadcastReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + Log.v(TAG, "mBroadcastReceiver.onReceive"); + + switch (intent.getAction()) { + case Constants.PLAYER_INTENT_STATUS_PLAYING: + mPlayerStatus = Constants.PLAYER_STATUS_PLAYING; + Log.v(TAG, "playing"); + mButton.setText("Stop"); + break; + case Constants.PLAYER_INTENT_STATUS_TEST: + String artist = intent.getStringExtra(Constants.PLAYER_INTENT_STATUS_ARTIST_NAME); + String songTitle = intent.getStringExtra(Constants.PLAYER_INTENT_STATUS_SONG_TITLE); + Log.v(TAG, artist + " " + songTitle); + mTextViewPlayerStatus.setText(artist); + mSongTitle.setText(songTitle); + break; + case Constants.PLAYER_INTENT_STATUS_BUFFERING: + mPlayerStatus = Constants.PLAYER_STATUS_BUFFERING; + mTextViewPlayerStatus.setText("Buffering..."); + mButton.setText("Stop buffer"); + Log.v(TAG, "buffering"); + break; + case Constants.PLAYER_INTENT_STATUS_STOPPED: + mPlayerStatus = Constants.PLAYER_STATUS_STOPPED; + mButton.setText("Play"); + mSongTitle.setText(""); + mTextViewPlayerStatus.setText("Radio SkyPlus"); + Log.v(TAG, "player stopped"); + break; + default: + Log.e(TAG, "unhandled intent received"); + break; + } + } + }; + + IntentFilter intentFilter = new IntentFilter(); + intentFilter.addAction(Constants.PLAYER_INTENT_STATUS_TEST); + intentFilter.addAction(Constants.PLAYER_INTENT_STATUS_PLAYING); + intentFilter.addAction(Constants.PLAYER_INTENT_STATUS_BUFFERING); + intentFilter.addAction(Constants.PLAYER_INTENT_STATUS_STOPPED); + + LocalBroadcastManager.getInstance(this).registerReceiver(mBroadcastReceiver, intentFilter); + } + + private void startMusicService() { + Log.v(TAG, "startMusicService"); + Intent intent = new Intent(this, BackgroundMusicService.class); + intent.putExtra("streamUrl", "http://sky.babahhcdn.com/SKYPLUS"); + this.startService(intent); + } + + private void stopMusicService() { + Intent intent = new Intent(Constants.PLAYER_INTENT_STATUS_STOP_PLAYER); + LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent); + Log.v(TAG, "stopMusicService"); + + } + + public void buttonPlayStopClicked(View view) { + switch (mPlayerStatus) { + case Constants.PLAYER_STATUS_STOPPED: + startMusicService(); + break; + case Constants.PLAYER_STATUS_BUFFERING: + stopMusicService(); + break; + case Constants.PLAYER_STATUS_PLAYING: + stopMusicService(); + break; + } + ; + } + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + switch (keyCode) { + case KeyEvent.KEYCODE_VOLUME_UP: + audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, + AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI); + adjustSeekBarValue(); + return true; + case KeyEvent.KEYCODE_VOLUME_DOWN: + audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, + AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI); + adjustSeekBarValue(); + return true; + default: + return super.onKeyDown(keyCode, event); + } + } + + private void setSeekBar() { + seekBarVolume = (SeekBar) findViewById(R.id.seekBarVolume); + seekBarVolume.setMax(audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC)); + adjustSeekBarValue(); + + seekBarVolume.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + @Override + public void onStopTrackingTouch(SeekBar arg0) { + } + + @Override + public void onStartTrackingTouch(SeekBar arg0) { + } + + @Override + public void onProgressChanged(SeekBar arg0, int progress, boolean arg2) { + audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, + progress, 0); + } + }); + } + + private void adjustSeekBarValue() { + seekBarVolume.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_MUSIC)); + } + + @Override + protected void onStop() { + super.onStop(); + LocalBroadcastManager.getInstance(this).unregisterReceiver(mBroadcastReceiver); + } +} diff --git a/KristoRadioPlayer/app/src/main/res/drawable-nodpi/music_backround_2.jpg b/KristoRadioPlayer/app/src/main/res/drawable-nodpi/music_backround_2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a6d107e00c788b018c044d70164775db39901c0d Binary files /dev/null and b/KristoRadioPlayer/app/src/main/res/drawable-nodpi/music_backround_2.jpg differ diff --git a/KristoRadioPlayer/app/src/main/res/drawable/Thumbs.db b/KristoRadioPlayer/app/src/main/res/drawable/Thumbs.db new file mode 100644 index 0000000000000000000000000000000000000000..98944a58003935e9cdd4f50dc0420c1ae7181f1a Binary files /dev/null and b/KristoRadioPlayer/app/src/main/res/drawable/Thumbs.db differ diff --git a/KristoRadioPlayer/app/src/main/res/drawable/shape.xml b/KristoRadioPlayer/app/src/main/res/drawable/shape.xml new file mode 100644 index 0000000000000000000000000000000000000000..1ec7e351da80149bb0c8832e241f53614a296ccb --- /dev/null +++ b/KristoRadioPlayer/app/src/main/res/drawable/shape.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" > + + <corners + android:bottomLeftRadius="10dp" + android:bottomRightRadius="10dp" + android:topLeftRadius="10dp" + android:topRightRadius="10dp" /> + <solid android:color="#280972" /> +</shape> \ No newline at end of file diff --git a/KristoRadioPlayer/app/src/main/res/layout/activity_main.xml b/KristoRadioPlayer/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000000000000000000000000000000000000..ac7c48bf568bf8223542dffedf82455245d4d428 --- /dev/null +++ b/KristoRadioPlayer/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/music_backround_2" + tools:context="com.example.kristo.kristoradioplayer.MainActivity"> + + <TextView + android:id="@+id/volumeControl" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:layout_marginLeft="20dp" + android:layout_marginTop="20dp" + android:text="Volume control" + android:textColor="#ef0404" + android:textSize="16sp" /> + + <SeekBar + android:id="@+id/seekBarVolume" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/volumeControl" + android:layout_margin="10dp" + android:max="15" + android:progress="3" + android:progressBackgroundTint="#ef0404" + android:progressTint="#ef0404" + android:thumbTint="#ef0404" /> + + <Button + android:id="@+id/buttonPlayStop" + style="@style/ButtonStyle" + android:layout_width="160dp" + android:layout_height="wrap_content" + + android:layout_alignParentBottom="true" + android:layout_marginBottom="50dp" + android:layout_marginLeft="20dp" + android:onClick="buttonPlayStopClicked" + android:text="Play" /> + + <TextView + android:id="@+id/textViewPlayerStatus" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_above="@id/buttonPlayStop" + android:layout_marginBottom="20dp" + android:layout_marginLeft="20dp" + android:textColor="#FFFFFF" + android:textSize="24sp" + tools:text="Player status..." /> + + <TextView + android:id="@+id/songTitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_above="@id/textViewPlayerStatus" + android:layout_marginBottom="20dp" + android:layout_marginLeft="20dp" + android:textColor="#FFFFFF" + android:textSize="32sp" + tools:text="Song title" /> + + +</RelativeLayout> diff --git a/KristoRadioPlayer/app/src/main/res/mipmap-hdpi/ic_launcher.png b/KristoRadioPlayer/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..cde69bcccec65160d92116f20ffce4fce0b5245c Binary files /dev/null and b/KristoRadioPlayer/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/KristoRadioPlayer/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/KristoRadioPlayer/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000000000000000000000000000000000000..9a078e3e1a42d474c78470a73c7987cf7ac5d9a0 Binary files /dev/null and b/KristoRadioPlayer/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/KristoRadioPlayer/app/src/main/res/mipmap-mdpi/ic_launcher.png b/KristoRadioPlayer/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..c133a0cbd379f5af6dbf1a899a0293ca5eccfad0 Binary files /dev/null and b/KristoRadioPlayer/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/KristoRadioPlayer/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/KristoRadioPlayer/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000000000000000000000000000000000000..efc028a636dd690a51db5a525cf781a5a7daba68 Binary files /dev/null and b/KristoRadioPlayer/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/KristoRadioPlayer/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/KristoRadioPlayer/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..bfa42f0e7b91d006d22352c9ff2f134e504e3c1d Binary files /dev/null and b/KristoRadioPlayer/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/KristoRadioPlayer/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/KristoRadioPlayer/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000000000000000000000000000000000000..3af2608a4492ef9ae63a77ec3305aedda89594cb Binary files /dev/null and b/KristoRadioPlayer/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/KristoRadioPlayer/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/KristoRadioPlayer/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..324e72cdd7480cb983fa1bcc7ce686e51ef87fe7 Binary files /dev/null and b/KristoRadioPlayer/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/KristoRadioPlayer/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/KristoRadioPlayer/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000000000000000000000000000000000..9bec2e623103ac9713b00cad8502a057c1efda61 Binary files /dev/null and b/KristoRadioPlayer/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/KristoRadioPlayer/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/KristoRadioPlayer/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..aee44e138434630332d88b1680f33c4b24c70ab3 Binary files /dev/null and b/KristoRadioPlayer/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/KristoRadioPlayer/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/KristoRadioPlayer/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000000000000000000000000000000000..34947cd6bbf9c729be83edc96ad08a1d42b82bc9 Binary files /dev/null and b/KristoRadioPlayer/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/KristoRadioPlayer/app/src/main/res/values/colors.xml b/KristoRadioPlayer/app/src/main/res/values/colors.xml new file mode 100644 index 0000000000000000000000000000000000000000..3ab3e9cbce07f7cdc941fc8ba424c05e83ed80f0 --- /dev/null +++ b/KristoRadioPlayer/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="colorPrimary">#3F51B5</color> + <color name="colorPrimaryDark">#303F9F</color> + <color name="colorAccent">#FF4081</color> +</resources> diff --git a/KristoRadioPlayer/app/src/main/res/values/strings.xml b/KristoRadioPlayer/app/src/main/res/values/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..f315aa2e5e301dd405b071af869851f8d8f802f2 --- /dev/null +++ b/KristoRadioPlayer/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ +<resources> + <string name="app_name">KristoRadioPlayer</string> +</resources> diff --git a/KristoRadioPlayer/app/src/main/res/values/styles.xml b/KristoRadioPlayer/app/src/main/res/values/styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..0eaa3a91c02698c524aac109b738d920407815b5 --- /dev/null +++ b/KristoRadioPlayer/app/src/main/res/values/styles.xml @@ -0,0 +1,16 @@ +<resources> + + <!-- Base application theme. --> + <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> + <!-- Customize your theme here. --> + <item name="colorPrimary">@color/colorPrimary</item> + <item name="colorPrimaryDark">@color/colorPrimaryDark</item> + <item name="colorAccent">@color/colorAccent</item> + </style> + <style name="ButtonStyle" parent="android:style/Widget.Button"> + <item name="android:background">@drawable/shape</item> + <item name="android:textSize">30dp</item> + <item name="android:textColor">#FFFFFF</item> + </style> + +</resources> diff --git a/KristoRadioPlayer/app/src/test/java/com/example/kristo/kristoradioplayer/ExampleUnitTest.java b/KristoRadioPlayer/app/src/test/java/com/example/kristo/kristoradioplayer/ExampleUnitTest.java new file mode 100644 index 0000000000000000000000000000000000000000..8b91b2c6b4e50b5637b673defa76d2c7d1cd0dd0 --- /dev/null +++ b/KristoRadioPlayer/app/src/test/java/com/example/kristo/kristoradioplayer/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.example.kristo.kristoradioplayer; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/KristoRadioPlayer/build.gradle b/KristoRadioPlayer/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..c2eea8e27fd12cc1e274a0940f06f350e855e20f --- /dev/null +++ b/KristoRadioPlayer/build.gradle @@ -0,0 +1,23 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.3' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/KristoRadioPlayer/gradle.properties b/KristoRadioPlayer/gradle.properties new file mode 100644 index 0000000000000000000000000000000000000000..aac7c9b4614ccfde6c721f24994cf30885a791d0 --- /dev/null +++ b/KristoRadioPlayer/gradle.properties @@ -0,0 +1,17 @@ +# 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. +org.gradle.jvmargs=-Xmx1536m + +# 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 diff --git a/KristoRadioPlayer/gradle/wrapper/gradle-wrapper.jar b/KristoRadioPlayer/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..13372aef5e24af05341d49695ee84e5f9b594659 Binary files /dev/null and b/KristoRadioPlayer/gradle/wrapper/gradle-wrapper.jar differ diff --git a/KristoRadioPlayer/gradle/wrapper/gradle-wrapper.properties b/KristoRadioPlayer/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..3df72687505f08de0179b21a2cd4d0816e3f1ba4 --- /dev/null +++ b/KristoRadioPlayer/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Nov 10 14:18:41 EET 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip diff --git a/KristoRadioPlayer/gradlew b/KristoRadioPlayer/gradlew new file mode 100644 index 0000000000000000000000000000000000000000..9d82f78915133e1c35a6ea51252590fb38efac2f --- /dev/null +++ b/KristoRadioPlayer/gradlew @@ -0,0 +1,160 @@ +#!/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 + +# 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\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +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"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # 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/KristoRadioPlayer/gradlew.bat b/KristoRadioPlayer/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..8a0b282aa6885fb573c106b3551f7275c5f17e8e --- /dev/null +++ b/KristoRadioPlayer/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/KristoRadioPlayer/settings.gradle b/KristoRadioPlayer/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..046dc4dd2dd52cfed2961cf5b31be427a2823d3a --- /dev/null +++ b/KristoRadioPlayer/settings.gradle @@ -0,0 +1 @@ +include ':app', ':volley' diff --git a/KristoRadioPlayer/volley b/KristoRadioPlayer/volley new file mode 160000 index 0000000000000000000000000000000000000000..536c1b741d18395a8aa041de484f3dc46fb57692 --- /dev/null +++ b/KristoRadioPlayer/volley @@ -0,0 +1 @@ +Subproject commit 536c1b741d18395a8aa041de484f3dc46fb57692