├── app
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── drawable
│ │ │ ├── bg.jpg
│ │ │ ├── dj_image.png
│ │ │ ├── news_bg.png
│ │ │ ├── arrow_large.png
│ │ │ ├── arrow_small.png
│ │ │ ├── normal_logo.png
│ │ │ ├── pause_large.png
│ │ │ ├── pause_small.png
│ │ │ ├── lollipop_logo.png
│ │ │ ├── actionbar_logo.png
│ │ │ ├── tab_selector.xml
│ │ │ ├── side_nav_bar.xml
│ │ │ ├── tab_indicator_selected.xml
│ │ │ ├── tab_indicator_default.xml
│ │ │ ├── launch_screen.xml
│ │ │ └── button_selector.xml
│ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_small.png
│ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-v21
│ │ │ ├── ic_menu_send.xml
│ │ │ ├── ic_menu_slideshow.xml
│ │ │ ├── ic_menu_gallery.xml
│ │ │ ├── ic_menu_manage.xml
│ │ │ ├── ic_menu_camera.xml
│ │ │ └── ic_menu_share.xml
│ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ ├── values
│ │ │ ├── dimens.xml
│ │ │ ├── drawables.xml
│ │ │ ├── colors.xml
│ │ │ ├── styles.xml
│ │ │ └── strings.xml
│ │ ├── values-v21
│ │ │ └── styles.xml
│ │ └── layout
│ │ │ ├── notification_layout.xml
│ │ │ ├── request_cell.xml
│ │ │ ├── page_buttons.xml
│ │ │ ├── requests.xml
│ │ │ ├── news.xml
│ │ │ ├── homescreen.xml
│ │ │ ├── now_playing.xml
│ │ │ └── queue_lp.xml
│ │ ├── java
│ │ └── io
│ │ │ └── r_a_d
│ │ │ └── radio
│ │ │ ├── ModelObjectMain.java
│ │ │ ├── Song.java
│ │ │ ├── DJImageTask.java
│ │ │ ├── PlayerState.java
│ │ │ ├── CustomPagerAdapter.java
│ │ │ ├── SongAdapter.java
│ │ │ ├── JSONScraperTask.java
│ │ │ ├── Requestor.java
│ │ │ ├── RadioService.java
│ │ │ └── ActivityMain.java
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── gradle.properties
├── LICENSE
├── .gitignore
└── README.md
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/drawable/bg.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/dj_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/drawable/dj_image.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/news_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/drawable/news_bg.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/arrow_large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/drawable/arrow_large.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/arrow_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/drawable/arrow_small.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/normal_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/drawable/normal_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/pause_large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/drawable/pause_large.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/pause_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/drawable/pause_small.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/lollipop_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/drawable/lollipop_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/actionbar_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/drawable/actionbar_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R-a-dio/R-a-dio-Amazing-Android-App/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_small.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_send.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_indicator_selected.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_indicator_default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 | 16dp
7 | 160dp
8 | 16dp
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/launch_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | -
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 | - @android:drawable/ic_menu_camera
3 | - @android:drawable/ic_menu_gallery
4 | - @android:drawable/ic_menu_slideshow
5 | - @android:drawable/ic_menu_manage
6 | - @android:drawable/ic_menu_share
7 | - @android:drawable/ic_menu_send
8 |
9 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\AndroidSDK/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/io/r_a_d/radio/ModelObjectMain.java:
--------------------------------------------------------------------------------
1 | package io.r_a_d.radio;
2 |
3 | /**
4 | * Created by Kilim on 12/28/2016.
5 | */
6 |
7 | public enum ModelObjectMain {
8 |
9 | NOWPLAYING(R.string.now_playing, R.layout.now_playing),
10 | REQUESTS(R.string.requests, R.layout.requests),
11 | NEWS(R.string.news, R.layout.news);
12 |
13 | private int mTitleResId;
14 | private int mLayoutResId;
15 |
16 | ModelObjectMain(int titleResId, int layoutResId) {
17 | mTitleResId = titleResId;
18 | mLayoutResId = layoutResId;
19 | }
20 |
21 | public int getTitleResId() {
22 | return mTitleResId;
23 | }
24 |
25 | public int getLayoutResId() {
26 | return mLayoutResId;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
19 |
20 | android.useAndroidX=true
21 | android.enableJetifier=true
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #383838
4 | #303030
5 | #303030
6 | #7A7A7A
7 | #DF4C3A
8 | #b7b7b7
9 | #999999
10 | #999999
11 | #7F7F7F
12 | #D3D3D3
13 | #3A7AAF
14 | #36667F
15 | #527a8e
16 | #5cb85c
17 | #5d7b5d
18 | #a15755
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | R/a/dio
3 | #000000
4 | #f5f5f5
5 | Home
6 | Request
7 | News
8 | Schedule
9 | LeftSlider
10 | NOWPLAYING
11 | REQUESTS
12 | NEWS
13 | Connecting...
14 | ...
15 |
16 | Open navigation drawer
17 | Close navigation drawer
18 |
19 | Settings
20 | FrameLayout
21 |
22 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/button_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
6 |
7 |
8 |
9 |
10 |
11 | -
14 |
15 |
16 |
17 |
18 |
19 | -
23 |
24 |
25 |
26 |
27 |
28 | -
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/java/io/r_a_d/radio/Song.java:
--------------------------------------------------------------------------------
1 | package io.r_a_d.radio;
2 |
3 | /**
4 | * Metadata for each song
5 | *
6 | * Created by Kethsar on 1/2/2017.
7 | */
8 |
9 | public class Song {
10 | private String mArtistName;
11 | private String mSongTitle;
12 | private boolean mRequestable; // Requestable depends on cooldowns
13 | private Integer mSongID; // The id is unique to the database
14 |
15 | public Song() {}
16 |
17 | public Song(String artist, String title, Integer songID, boolean requestable){
18 | mSongTitle = title;
19 | mArtistName = artist;
20 | mSongID = songID;
21 | mRequestable = requestable;
22 | }
23 |
24 | public String getArtistName(){
25 | return mArtistName;
26 | }
27 |
28 | public void setArtistName(String artistName){
29 | mArtistName = artistName;
30 | }
31 |
32 | public String getSongTitle(){
33 | return mSongTitle;
34 | }
35 |
36 | public void setSongTitle(String songTitle){
37 | mSongTitle = songTitle;
38 | }
39 |
40 | public Integer getSongID(){
41 | return mSongID;
42 | }
43 |
44 | public void setSongID(Integer songID){
45 | mSongID = songID;
46 | }
47 |
48 | public boolean IsRequestable(){
49 | return mRequestable;
50 | }
51 |
52 | public void setRequestable(boolean requestable){
53 | mRequestable = requestable;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/notification_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
25 |
26 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/io/r_a_d/radio/DJImageTask.java:
--------------------------------------------------------------------------------
1 | package io.r_a_d.radio;
2 |
3 | import android.os.AsyncTask;
4 | import androidx.core.graphics.drawable.RoundedBitmapDrawable;
5 | import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
6 |
7 | import java.io.IOException;
8 | import java.io.InputStream;
9 | import java.net.URL;
10 |
11 | /**
12 | * Grabs the DJ image and also updates the UI with it
13 | */
14 | class DJImageTask extends AsyncTask {
15 |
16 | private ActivityMain activity;
17 |
18 | public DJImageTask(ActivityMain activity) {
19 | this.activity = activity;
20 | }
21 |
22 | /**
23 | * Grab the image for the current DJ
24 | *
25 | * @param urlToScrape
26 | * @return
27 | */
28 | @Override
29 | protected RoundedBitmapDrawable doInBackground(String... urlToScrape) {
30 | InputStream is = null;
31 | RoundedBitmapDrawable roundDrawable = null;
32 | try {
33 | is = (InputStream) new URL(urlToScrape[0]).getContent();
34 | roundDrawable = RoundedBitmapDrawableFactory.create(activity.getResources(), is);
35 | roundDrawable.setCircular(true);
36 | } catch (IOException e) {
37 | e.printStackTrace();
38 | }
39 | return roundDrawable;
40 | }
41 |
42 | /**
43 | * Set the DJ image on the UI
44 | *
45 | * @param image
46 | */
47 | @Override
48 | protected void onPostExecute(RoundedBitmapDrawable image) {
49 | activity.setDJImage(image);
50 | }
51 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | R-a-dio-Amazing-Android-App.iml
2 | .idea
3 | .gradle
4 | gradlew
5 | gradlew.bat
6 | local.properties
7 | build
8 | gradle
9 | app/app.iml
10 | release/
11 |
12 | # Built application files
13 | *.apk
14 | *.ap_
15 | *.aab
16 |
17 | # Files for the ART/Dalvik VM
18 | *.dex
19 |
20 | # Java class files
21 | *.class
22 |
23 | # Generated files
24 | bin/
25 | gen/
26 | out/
27 |
28 | # Gradle files
29 | .gradle/
30 | build/
31 |
32 | # Local configuration file (sdk path, etc)
33 | local.properties
34 |
35 | # Proguard folder generated by Eclipse
36 | proguard/
37 |
38 | # Log Files
39 | *.log
40 |
41 | # Android Studio Navigation editor temp files
42 | .navigation/
43 |
44 | # Android Studio captures folder
45 | captures/
46 |
47 | # IntelliJ
48 | *.iml
49 | .idea/workspace.xml
50 | .idea/tasks.xml
51 | .idea/gradle.xml
52 | .idea/assetWizardSettings.xml
53 | .idea/dictionaries
54 | .idea/libraries
55 | .idea/caches
56 |
57 | # Keystore files
58 | # Uncomment the following lines if you do not want to check your keystore files in.
59 | #*.jks
60 | #*.keystore
61 |
62 | # External native build folder generated in Android Studio 2.2 and later
63 | .externalNativeBuild
64 |
65 | # Google Services (e.g. APIs or Firebase)
66 | # google-services.json
67 |
68 | # Freeline
69 | freeline.py
70 | freeline/
71 | freeline_project_description.json
72 |
73 | # fastlane
74 | fastlane/report.xml
75 | fastlane/Preview.html
76 | fastlane/screenshots
77 | fastlane/test_output
78 | fastlane/readme.md
79 |
80 | # Version control
81 | vcs.xml
82 |
83 | # lint
84 | lint/intermediates/
85 | lint/generated/
86 | lint/outputs/
87 | lint/tmp/
88 | # lint/reports/
89 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | /* Java 8 support is needed for ExoPlayer 2.10.5
6 | * Source : https://github.com/google/ExoPlayer/issues/5276
7 | * */
8 | compileOptions {
9 | targetCompatibility JavaVersion.VERSION_1_8
10 | }
11 | defaultConfig {
12 | applicationId "io.r_a_d.radio"
13 | minSdkVersion 16
14 | targetSdkVersion 28
15 | versionName '1.2.1.2'
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | versionCode 9
18 | }
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | productFlavors {
26 | }
27 | }
28 |
29 | dependencies {
30 | implementation fileTree(include: ['*.jar'], dir: 'libs')
31 | androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
32 | exclude group: 'com.android.support', module: 'support-annotations'
33 | })
34 | implementation 'androidx.appcompat:appcompat:1.1.0'
35 | implementation 'com.google.android.material:material:1.0.0'
36 | implementation 'com.google.android.exoplayer:exoplayer:2.10.5'
37 | testImplementation 'junit:junit:4.12'
38 |
39 | // adding media dependency from Google Maven repository. From:
40 | // https://developer.android.com/jetpack/androidx/releases/media/
41 | def media_version = "1.1.0"
42 | implementation "androidx.media:media:$media_version"
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/java/io/r_a_d/radio/PlayerState.java:
--------------------------------------------------------------------------------
1 | package io.r_a_d.radio;
2 |
3 | import java.net.URLDecoder;
4 |
5 | /**
6 | * Global player state for the app
7 | *
8 | * Used for synchronizing the state between the Activity and the Service
9 | *
10 | * Created by resttime on 1/3/2017.
11 | *
12 | * 2018/04/02, Kethsar: Properly use getters and setters rather than public variables
13 | * Split NowPlaying into artist and title
14 | */
15 |
16 | public final class PlayerState {
17 | private static boolean m_playing = false;
18 | private static boolean m_serivceStarted = false;
19 | private static String m_artist = "";
20 | private static String m_title = "";
21 |
22 | public static boolean isPlaying() { return m_playing; }
23 | public static void setPlayingStatus(boolean status) { m_playing = status; }
24 | public static boolean isServiceStarted() { return m_serivceStarted; }
25 | public static void setServiceStatus(boolean status) { m_serivceStarted = status; }
26 | public static String getArtist() { return m_artist; }
27 | public static String getTitle() { return m_title; }
28 |
29 | public static void setNowPlaying(String nowPlaying) {
30 | int hyphenPos = nowPlaying.indexOf(" - ");
31 |
32 | if (hyphenPos == -1) {
33 | m_title = nowPlaying;
34 | m_artist = "";
35 | } else {
36 | try {
37 | m_title = URLDecoder.decode(nowPlaying.substring(hyphenPos + 3), "UTF-8");
38 | m_artist = URLDecoder.decode(nowPlaying.substring(0, hyphenPos), "UTF-8");
39 | } catch (Exception e) {
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/io/r_a_d/radio/CustomPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package io.r_a_d.radio;
2 |
3 | /**
4 | * Created by Kilim on 12/28/2016.
5 | */
6 |
7 | import android.content.Context;
8 | import androidx.viewpager.widget.PagerAdapter;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 |
13 | public class CustomPagerAdapter extends PagerAdapter {
14 |
15 | private Context mContext;
16 |
17 | public CustomPagerAdapter(Context context) {
18 | mContext = context;
19 | }
20 |
21 | @Override
22 | public Object instantiateItem(ViewGroup collection, int position) {
23 | ModelObjectMain modelObjectMain = ModelObjectMain.values()[position];
24 | LayoutInflater inflater = LayoutInflater.from(mContext);
25 | ViewGroup layout = (ViewGroup) inflater.inflate(modelObjectMain.getLayoutResId(), collection, false);
26 | collection.addView(layout);
27 | return layout;
28 | }
29 |
30 | @Override
31 | public void destroyItem(ViewGroup collection, int position, Object view) {
32 | collection.removeView((View) view);
33 | }
34 |
35 | @Override
36 | public int getCount() {
37 | return ModelObjectMain.values().length;
38 | }
39 |
40 | @Override
41 | public boolean isViewFromObject(View view, Object object) {
42 | return view == object;
43 | }
44 |
45 | @Override
46 | public CharSequence getPageTitle(int position) {
47 | ModelObjectMain customPagerEnum = ModelObjectMain.values()[position];
48 |
49 | return mContext.getString(customPagerEnum.getTitleResId());
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
18 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | R/a/dio on the go, finally! With this app you can listen to the stream
15 | with a dedicated app! You may request songs, check up on the latest
16 | news, browse the last played songs + queue and most importantly, tune
17 | in!
18 |
19 | R/a/dio is a website that was founded 7+ years ago with the intention
20 | of bringing you a stream of (mostly) high quality anime music, and we
21 | keep that up to this day! You can always drop by and visit our website
22 | https://r-a-d.io for more robust features as well as reading up on
23 | everything.
24 |
25 | The app will continuously improve. If there are any bugs please report
26 | it here, or on the site.
27 |
28 | As always, thanks for listening!
29 |
30 | Gato-goto choo-choo!
31 |
32 | ## Updates
33 | ### 1.2.1.2 (April 18, 2018)
34 | - Hopefully fix crash when attempting to unbind from a service no longer bound
35 | - Hopefully maybe likely not fix the long-standing MediaButtonReceiver crashes
36 | - Probably break bluetooth things further, we'll see
37 | ### 1.2 (April 2, 2018)
38 | - Bluetooth tags
39 | - Pagination for search results
40 | ### 1.15 (January 18, 2018)
41 | - Fix null pointer exception
42 | - Start/stop audio service when other audio apps are active
43 | - More aesthetic changes
44 | ### 1.1 (January 17, 2018)
45 | - More transparent searching (searching... etc)
46 | - Change the song in the Queue to be a lighter shade of blue if requested
47 | - Back button
48 | - Copying currently playing songs easier + q/lp
49 | - Lower the font on NP so it doesn't scroll that much
50 |
--------------------------------------------------------------------------------
/app/src/main/java/io/r_a_d/radio/SongAdapter.java:
--------------------------------------------------------------------------------
1 | package io.r_a_d.radio;
2 |
3 | import android.content.Context;
4 | import androidx.annotation.NonNull;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.ArrayAdapter;
9 | import android.widget.Button;
10 | import android.widget.TextView;
11 |
12 | import java.util.ArrayList;
13 |
14 | /**
15 | * Implements the layout where a list of songs can be requested is displayed
16 | *
17 | * Created by Kethsar on 1/2/2017.
18 | */
19 |
20 | public class SongAdapter extends ArrayAdapter {
21 | private Context mContext;
22 | private ArrayList mSongs;
23 | private ActivityMain mActivity;
24 |
25 | public SongAdapter(Context context, int resource, ArrayList songs) {
26 | super(context, resource, songs);
27 | mContext = context;
28 | mSongs = songs;
29 | mActivity = (ActivityMain)context;
30 | }
31 |
32 | @NonNull
33 | @Override
34 | public View getView(int position, View convertView, ViewGroup parent) {
35 | View view = convertView;
36 |
37 | if(view == null){
38 | LayoutInflater inflater = LayoutInflater.from(mContext);
39 | view = inflater.inflate(R.layout.request_cell, null);
40 | }
41 |
42 | Song song = mSongs.get(position);
43 | TextView titleView = (TextView) view.findViewById(R.id.songTitle);
44 | TextView artistView = (TextView) view.findViewById(R.id.artistName);
45 | Button requestButton = (Button) view.findViewById(R.id.requestButton);
46 |
47 | titleView.setText(song.getSongTitle());
48 | artistView.setText(song.getArtistName());
49 | requestButton.setEnabled(song.IsRequestable());
50 | requestButton.setHint(song.getSongID().toString());
51 |
52 | requestButton.setOnClickListener(new View.OnClickListener() {
53 | @Override
54 | public void onClick(View v) {
55 | Button b = (Button) v;
56 | mActivity.makeRequest(Integer.parseInt(b.getHint().toString()));
57 | }
58 | });
59 |
60 | return view;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/request_cell.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
20 |
21 |
35 |
36 |
49 |
50 |
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/java/io/r_a_d/radio/JSONScraperTask.java:
--------------------------------------------------------------------------------
1 | package io.r_a_d.radio;
2 |
3 | import android.os.AsyncTask;
4 |
5 | import org.json.JSONException;
6 |
7 | import java.io.BufferedReader;
8 | import java.io.IOException;
9 | import java.io.InputStreamReader;
10 | import java.net.MalformedURLException;
11 | import java.net.URL;
12 |
13 | /**
14 | * API scraper which also updates the UI depending on what the parameter at construction
15 | */
16 | class JSONScraperTask extends AsyncTask {
17 |
18 | private URL api_url_scraper;
19 | private ActivityMain activity;
20 | private Integer uitocall;
21 |
22 | public JSONScraperTask(ActivityMain activity, Integer methodtocall)
23 | {
24 | this.activity = activity;
25 | this.uitocall = methodtocall;
26 | }
27 |
28 | /**
29 | * Read in the json from the api
30 | *
31 | * @param urlToScrape
32 | * @return json string of the api
33 | */
34 | @Override
35 | protected String doInBackground(String... urlToScrape) {
36 | BufferedReader reader = null;
37 | StringBuilder builder = new StringBuilder();
38 | try {
39 | api_url_scraper = new URL(urlToScrape[0]);
40 | } catch (MalformedURLException e) {
41 | e.printStackTrace();
42 | }
43 | try {
44 | reader = new BufferedReader(new InputStreamReader(api_url_scraper.openStream(), "UTF-8"));
45 | for (String line; (line = reader.readLine()) != null;) {
46 | builder.append(line.trim());
47 | }
48 | } catch (IOException e) {
49 | e.printStackTrace();
50 | } finally {
51 | if (reader != null) try { reader.close(); } catch (IOException ignored) {}
52 | }
53 | return builder.toString();
54 | }
55 |
56 | /**
57 | * Update the UI after we successfully have the api information
58 | *
59 | * @param json Grabbed from the REST api
60 | */
61 | @Override
62 | protected void onPostExecute(String json) {
63 | try {
64 | switch (uitocall){
65 | case 0:
66 | activity.setUIJSON(json);
67 | break;
68 | case 1:
69 | activity.setNewsUI(json);
70 | break;
71 | case 2:
72 | activity.setSongList(json);
73 | break;
74 | }
75 | } catch (JSONException e) {
76 | e.printStackTrace();
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/page_buttons.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
17 |
18 |
26 |
27 |
35 |
36 |
44 |
45 |
53 |
54 |
62 |
63 |
71 |
72 |
80 |
81 |
89 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/requests.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
19 |
20 |
40 |
41 |
49 |
50 |
58 |
59 |
60 |
61 |
66 |
67 |
76 |
77 |
82 |
83 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/news.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
19 |
20 |
24 |
25 |
30 |
31 |
41 |
42 |
43 |
44 |
53 |
54 |
58 |
59 |
64 |
65 |
75 |
76 |
77 |
78 |
87 |
88 |
92 |
93 |
98 |
99 |
109 |
110 |
111 |
112 |
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/homescreen.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
15 |
16 |
23 |
24 |
31 |
32 |
39 |
40 |
50 |
51 |
57 |
58 |
68 |
69 |
77 |
78 |
79 |
80 |
81 |
86 |
87 |
93 |
94 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
117 |
118 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/app/src/main/java/io/r_a_d/radio/Requestor.java:
--------------------------------------------------------------------------------
1 | package io.r_a_d.radio;
2 |
3 | import android.os.AsyncTask;
4 | import android.widget.Toast;
5 |
6 | import org.json.JSONException;
7 | import org.json.JSONObject;
8 |
9 | import java.io.BufferedReader;
10 | import java.io.IOException;
11 | import java.io.InputStreamReader;
12 | import java.io.OutputStream;
13 | import java.net.CookieHandler;
14 | import java.net.CookieManager;
15 | import java.net.MalformedURLException;
16 | import java.net.URL;
17 | import java.util.regex.Matcher;
18 | import java.util.regex.Pattern;
19 |
20 | import javax.net.ssl.HttpsURLConnection;
21 |
22 | /**
23 | * Requests a song via the website's API
24 | *
25 | * We scrape the website for a CSRF token and POST it to /request/ endpoint with
26 | * the song id
27 | *
28 | * Created by Kethsar on 1/2/2017.
29 | */
30 |
31 | public class Requestor {
32 | private CookieManager mCookieManager;
33 | private ActivityMain mActivity;
34 | private final String REQUEST_URL = "https://r-a-d.io/request/%1$d";
35 | private String mToken;
36 |
37 | public Requestor(ActivityMain activity){
38 | mActivity = activity;
39 | mCookieManager = new CookieManager();
40 | mToken = null;
41 | }
42 |
43 | public void setToken(String token){
44 | mToken = token;
45 | }
46 |
47 | public String getToken(){
48 | return mToken;
49 | }
50 |
51 | public void Request(Integer songID){
52 | String request = String.format(REQUEST_URL, songID);
53 |
54 | if(mToken == null){
55 | CookieTask ct = new CookieTask(this);
56 | ct.execute(mCookieManager);
57 | }
58 |
59 | new RequestTask(this, mActivity).execute(request);
60 | }
61 |
62 | /**
63 | * Scrape the website for the CSRF token required for requesting
64 | */
65 | protected class CookieTask extends AsyncTask{
66 | private final String RADIO_SEARCH = "https://r-a-d.io/search";
67 | private Requestor mRequestor;
68 |
69 | public CookieTask(Requestor req){
70 | mRequestor = req;
71 | }
72 |
73 | @Override
74 | protected String doInBackground(CookieManager... params) {
75 | URL searchURL = null;
76 | String retVal = null;
77 | BufferedReader reader = null;
78 |
79 | CookieHandler.setDefault(params[0]);
80 |
81 | try {
82 | searchURL = new URL(RADIO_SEARCH);
83 | } catch (MalformedURLException e) {
84 | e.printStackTrace();
85 | }
86 |
87 | try {
88 | reader = new BufferedReader(new InputStreamReader(searchURL.openStream(), "UTF-8"));
89 | for (String line; (line = reader.readLine()) != null;) {
90 | line = line.trim();
91 | Pattern p = Pattern.compile("value=\"(\\w+)\"");
92 | Matcher m = p.matcher(line);
93 |
94 | if(line.startsWith("