Skip to content
This repository has been archived by the owner on Feb 1, 2025. It is now read-only.

Commit

Permalink
Kotlin Rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
y20k committed Apr 21, 2020
1 parent 9d03c79 commit 198ef82
Show file tree
Hide file tree
Showing 208 changed files with 9,268 additions and 9,537 deletions.
File renamed without changes.
64 changes: 2 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ README
Transistor - Simple Radio App
-----------------------------

**Version 3.2.x ("Life on Mars?")**
**Version 4.0.x ("Andy Warhol")**

Transistor is a bare bones app for listening to radio programs over the internet. The app stores stations as files on your device's external storage. It currently understands streams encoded in MP3, AAC and Ogg/Opus(*).

Important note: This is an app of type BYOS ("bring your own station"). It does not feature any kind of built-in search option. You will have to manually add radio stations.
Transistor is a bare bones app for listening to radio programs over the internet.

Transistor is free software. It is published under the [MIT open source license](https://opensource.org/licenses/MIT). Want to help? Please check out the notes in [CONTRIBUTING.md](https://github.com/y20k/transistor/blob/master/CONTRIBUTING.md) first.

Expand All @@ -19,61 +17,3 @@ Install Transistor
[<img src="https://cloud.githubusercontent.com/assets/9103935/14702535/45f6326a-07ab-11e6-9256-469c1dd51c22.png" width="192">](https://f-droid.org/repository/browse/?fdid=org.y20k.transistor)

[... or get a Release APK here on GitHub](https://github.com/y20k/transistor/releases)

How to use Transistor
---------------------
### How to add a new radio station?
The easiest way to add a new station is to [search for streaming links](https://github.com/y20k/transistor/wiki#places-to-look-for-radio-stations) and then choose Transistor as a your default handler for those file types. You can also tap the (+) symbol in the top bar and paste in streaming links directly. Please note: Transistor does not feature any kind of built-in search option.

### How to play back a radio station?
Tap the Play button ;).

### How to stop playback?
Tap the Stop button within the app or on the notification - or just unplug your headphones.

### How to start the sleep timer?
Tapping the Clock symbol in the stations detail screen starts a 15 minute countdown after which Transistor stops playback. An additional tap adds 15 minutes to the clock. Playback must be running to be able to activate the sleep timer.

### How to place a station shortcut on the Home screen?
The option to place a shortcut for a station on the Home screen can be accessed from the station's three dots menu. A tap on a shortcut will open Transistor - playback will start immediately.

### How to rename or delete a station?
The rename and delete options can be accessed both from the station's detail screen. Just tap on the three dots symbol. You can manage the list of stations also from a file browser (see next question).

### Where does Transistor store its stations?
Transistor does not save its list of stations in a database. Instead it stores stations as M3U files on your device's external storage. Feel free to tinker with those files using the text editor of your choice. The files are stored in /Android/data/org.y20k.transistor/files/Collection.

### How do I backup and transfer my radio stations?
Transistor supports Android 6's [Auto Backup](http://developer.android.com/about/versions/marshmallow/android-6.0.html#backup) feature. Radio stations are always backed up to your Google account and will be restored at reinstall. On devices running on older versions of Android you must manually save and restore the "Collection" folder.

### Why does Transistor not have any setting?
There is nothing to be set ;). Transistor is a very simple app. Depending on your point of view "simple" is either great or lame.

Which Permissions does Transistor need?
---------------------------------------
### Permission "INSTALL_SHORTCUT" and "UNINSTALL_SHORTCUT"
This permission is needed to install and uninstall radio station shortcuts on the Android Home screen.

### Permission "INTERNET"
Transistor streams radio stations over the internet.

### Permission "READ_EXTERNAL_STORAGE"
Transistor needs access to images, photos and documents to be able to customize radio station icons and to able to open locally saved playlist files.

### Permission "VIBRATE"
Tapping and holding a radio station will toggle a tiny vibration.

### Permission "WAKE_LOCK"
During Playback Transistor acquires a so called partial wake lock. That prevents the Android system to stop playback for power saving reasons.

(*) Opus playback is only supported on devices running Android 5.0+

Screenshots (v3.2)
---------------------
[<img src="https://raw.githubusercontent.com/y20k/transistor/master/metadata/en-US/phoneScreenshots/01-lockscreen-active-v3.2-oneplus5.png" width="240">](https://raw.githubusercontent.com/y20k/transistor/master/metadata/en-US/phoneScreenshots/01-lockscreen-active-v3.2-oneplus5.png)
[<img src="https://raw.githubusercontent.com/y20k/transistor/master/metadata/en-US/phoneScreenshots/02-playback-v3.2-oneplus5.png" width="240">](https://raw.githubusercontent.com/y20k/transistor/master/metadata/en-US/phoneScreenshots/02-playback-v3.2-oneplus5.png)
[<img src="https://raw.githubusercontent.com/y20k/transistor/master/metadata/en-US/phoneScreenshots/03-details-v3.2-oneplus5.png" width="240">](https://raw.githubusercontent.com/y20k/transistor/master/metadata/en-US/phoneScreenshots/03-details-v3.2-oneplus5.png)

[<img src="https://raw.githubusercontent.com/y20k/transistor/master/metadata/en-US/phoneScreenshots/04-sleeptimer-v3.2-oneplus5.png" width="240">](https://raw.githubusercontent.com/y20k/transistor/master/metadata/en-US/phoneScreenshots/04-sleeptimer-v3.2-oneplus5.png)
[<img src="https://raw.githubusercontent.com/y20k/transistor/master/metadata/en-US/phoneScreenshots/05-homescreen-v3.2-oneplus5.png" width="240">](https://raw.githubusercontent.com/y20k/transistor/master/metadata/en-US/phoneScreenshots/05-homescreen-v3.2-oneplus5.png)
[<img src="https://raw.githubusercontent.com/y20k/transistor/master/metadata/en-US/phoneScreenshots/06-onboarding-v3.2-oneplus5.png" width="240">](https://raw.githubusercontent.com/y20k/transistor/master/metadata/en-US/phoneScreenshots/06-onboarding-v3.2-oneplus5.png)
3 changes: 1 addition & 2 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.DS_Store
/build
/build
104 changes: 59 additions & 45 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,80 +1,94 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {

android {
compileSdkVersion 29
// buildToolsVersion is optional because the plugin uses a recommended version by default

defaultConfig {
applicationId 'org.y20k.transistor'
minSdkVersion 25
targetSdkVersion 29
versionCode 72
versionName '4.0.0'
resConfigs "en", "ar", "ca", "cs","de", "el", "es", "eu", "fr", "id", "in", "it", "ja", "kab", "nb-rNO", "nl", "pa", "pl", "pt", "pt-rBR", "ru", "sk", "sl", "sr", "th", "tr", "uk", "zh-rCN"
}

kotlinOptions {
jvmTarget = '1.8'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
applicationId 'org.y20k.transistor'
minSdkVersion 19
targetSdkVersion 29
versionCode 71
versionName '3.2.4'

vectorDrawables.useSupportLibrary = true
resConfigs "en", "ar", "ca", "cs","de", "el", "es", "eu", "fr", "id", "in", "it", "ja", "kab", "nb-rNO", "nl", "pa", "pl", "pt", "pt-rBR", "ru", "sk", "sl", "sr", "th", "tr", "uk", "zh-rCN"
lintOptions{
disable 'MissingTranslation'
}

buildTypes {

release {
// Enables code shrinking, obfuscation, and optimization for only
// your project's release build type.
minifyEnabled true

// Enables resource shrinking, which is performed by the
// Android Gradle plugin.
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

// Includes the default ProGuard rules files that are packaged with
// the Android Gradle plugin. To learn more, go to the section about
// R8 configuration files.
proguardFiles getDefaultProguardFile(
'proguard-android-optimize.txt'),
'proguard-rules.pro'
}
debug {
// Comment out the below lines if you do not need to test resource shrinking
// minifyEnabled true
// shrinkResources true
// proguardFiles getDefaultProguardFile(
// 'proguard-android-optimize.txt'),
// 'proguard-rules.pro'
}

}

lintOptions {
disable 'MissingTranslation'
}
}


dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0"

implementation "com.google.android.material:material:1.1.0-beta01"

implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.palette:palette:1.0.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
implementation "androidx.media:media:1.1.0"
implementation "androidx.lifecycle:lifecycle-runtime:2.2.0"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"

implementation "com.google.android.material:material:1.1.0-beta01"

implementation "com.google.android.exoplayer:exoplayer-core:2.10.8"
implementation "com.google.android.exoplayer:exoplayer-hls:2.10.8"
implementation "androidx.core:core-ktx:1.2.0"
implementation "androidx.activity:activity-ktx:1.1.0"
implementation "androidx.palette:palette:1.0.0"
implementation "androidx.preference:preference:1.1.1"
implementation "androidx.preference:preference-ktx:1.1.1"

}
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'

implementation "android.arch.work:work-runtime-ktx:1.0.1"

// Support legacy language codes
// https://developer.android.com/reference/java/util/Locale#legacy-language-codes
// Credit: https://github.com/TeamAmaze/AmazeFileManager/blob/541c98fc77a9415bcd4a1279b85c6c2d38f669c1/app/build.gradle#L212
implementation "com.google.android.exoplayer:exoplayer:2.11.4"
implementation "com.google.android.exoplayer:extension-mediasession:2.11.4"
implementation "com.google.code.gson:gson:2.8.6"

task supportLegacyLanguageCodes
implementation 'com.android.volley:volley:1.1.1'

[['id', 'in'], ['yi', 'ji'], ['he', 'iw']].forEach { sourceCode, destinationCode ->
def copyTask = tasks.create('copyStrings' + sourceCode + 'Into' + destinationCode, Copy) {
description('copying values-' + sourceCode + ' strings into values-' + destinationCode)
from('src/main/res/values-' + sourceCode)
into('src/main/res/values-' + destinationCode)
include('strings.xml')
}
supportLegacyLanguageCodes.dependsOn copyTask
}

project.afterEvaluate {
preBuild.dependsOn supportLegacyLanguageCodes
androidExtensions {
experimental = true
}

clean.dependsOn supportLegacyLanguageCodes
clean.mustRunAfter supportLegacyLanguageCodes
24 changes: 18 additions & 6 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/solaris/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
# You can control the set of applied configuration files using the
# proguardFiles setting 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


# Preserve the core classes - because they need to be de-/serialized with GSON
-keep public class org.y20k.transistor.core.** { *; }

-keep public class org.y20k.transistor.PlayerService { *; }

-keep public class org.y20k.transistor.search.GpodderResult { *; }
Loading

0 comments on commit 198ef82

Please sign in to comment.