A showcase music app for Android entirely written using Kotlin language

Overview

Bandhook Kotlin

This project is a small replica of the app I developed some time ago. Bandhook can still be found on Play Store

At the moment it will only connect to LastFm and retrieve some music bands. It will let navigate to the artist detail. This is what you´ll get:

Bandhook Kotlin

The purpose of the project is to show a complex (at least in architecture) project entirely written using Kotlin. This example also supports the articles written in antonioleiva.com related to Kotlin for Android:

This sample project is still in development, and could easily break or have some messy code. However, any idea or suggestion to improve it will be welcomed. Feel free to open an issue if you think something could be improved.

How to use this project

You can use Android Studio or Intellij to work with this repository.

First thing you will need to compile this project is to get an API Key from Last.fm. It will we used to connect to the service that will provide artists info. Then create a resource file app/src/main/res/values/api_key.xml (this path is ignored by git) with the following content:

<string name="last_fm_api_key">YOUR_KEY</string>

The Kotlin plugin for Android Studio is also required.

Many ideas on how this project is organized were taken from Clean Contacts project, by PaNaVTEC. There are some slight differences, but reading How to start section will be helpful.

License

Copyright 2015 Antonio Leiva

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Gradle Core Plugins (plugin is not in 'org.gradle' namespace)

    Gradle Core Plugins (plugin is not in 'org.gradle' namespace)

    Hi, I got the error when build this project:

    Error:(21, 0) Plugin [id: 'com.android.application'] was not found in any of the following sources:

    • Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
    • Gradle Central Plugin Repository (plugin dependency must include a version number for this source) Open File

    what should I do?

    opened by wangqianjun 18
  • Add albums

    Add albums

    Description

    Add albums to the app. Artist albums are shown in the activity that used to be called DetailActivity, now it is called ArtistActivity. Biography and albums are shown in a view pager with tabs similar to the approach used in the original bandhook app. I've migrated artist activity to use design support library from ObservableScrollView, that makes the code simpler. And there is also an activity to show an album, that looks like the image in the issue.

    screenshot-2016-07-08_13 23 32 299

    screenshot-2016-07-08_13 23 39 351

    opened by alex-tpom6oh 6
  • Move dependency injection to Dagger 2

    Move dependency injection to Dagger 2

    Dagger 2 is supposed to be working on Kotlin, so it´s a good idea to try and move DI to that direction. Reasons:

    • Current DI is supported by language, which is really good. But it´s a bit verbose and hard to maintain.
    • Couldn´t find a way to make scoped injections, very useful for Android.
    • The sole reason of learning Dagger 2 and see how it fits in a Kotlin project.
    enhancement 
    opened by antoniolg 3
  • Grade import error at the current state

    Grade import error at the current state

    Hi thank you for sharing this awesome project.

    Right now when I download and try to launch using the Android Studio 3.0 Canary version, I get the following error:

    Error:Unable to find method 'com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List;'. Possible causes for this unexpected error include:

    In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

    opened by rikuto-bigarms 2
  • Unit Tests Fix

    Unit Tests Fix

    Fixed Retrofit 2 service mocking having invalid return type in Unit Tests, it was implemented to return the expected deserialized response directly, however, it should return a Retrofit Call type of the response, thus I pulled a Fake implementation of Retrofit Call (from: https://github.com/square/retrofit/blob/master/retrofit-mock/src/main/java/retrofit2/mock/Calls.java) where it's initialized using either a Response (i.e. success, error) or IOException to simulate network issues if required

    opened by mabdurrahman 2
  • Handle nullable mbid

    Handle nullable mbid

    Description

    I, as well as @alanwgeorge, noticed that the app does not work because one of the artists in the demo set does not have 'mbid'. Since this field is used to fetch additional data about the artist I think that the best solution is to drop artists that do not have this field set.

    Plus I've added some tests for ArtistMapper.

    opened by alex-tpom6oh 2
  • Minor fix

    Minor fix

    When clicking the list item, the app was constantly crashing on my phone with this exception:

    03-25 00:13:01.539 5860-5993/com.antonioleiva.bandhookkotlin W/OpenGLRenderer: Layer exceeds max. dimensions supported by the GPU (1080x7160, max=4096x4096)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception 'java.lang.IllegalStateException' thrown in void android.os.MessageQueue.nativePollOnce(long, int):-2
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]     in call to CallVoidMethodV
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]     from void android.os.MessageQueue.nativePollOnce(long, int)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65] "main" prio=5 tid=1 Runnable
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   | group="main" sCount=0 dsCount=0 obj=0x75bc9040 self=0xb7852a70
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   | sysTid=5860 nice=0 cgrp=apps sched=0/0 handle=0xb6f1c058
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   | state=R schedstat=( 0 0 0 ) utm=43 stm=12 core=0 HZ=100
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   | stack=0xbe5a9000-0xbe5ab000 stackSize=8MB
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   | held mutexes= "mutator lock"(shared held)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #00 pc 00004828  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #01 pc 00002ec5  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #02 pc 0024437d  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+68)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #03 pc 0022774b  /system/lib/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+394)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #04 pc 000af2db  /system/lib/libart.so (art::JniAbort(char const*, char const*)+582)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #05 pc 000afa21  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #06 pc 000b2b9b  /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1286)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #07 pc 000ba05f  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+30)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #08 pc 00060283  /system/lib/libandroid_runtime.so (???)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #09 pc 000746d1  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::dispatchVsync(long long, int, unsigned int)+40)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #10 pc 0007494f  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::handleEvent(int, int, void*)+142)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #11 pc 00013f07  /system/lib/libutils.so (android::Looper::pollInner(int)+594)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #12 pc 00013fc9  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #13 pc 000803fd  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   native: #14 pc 000b1e37  /data/dalvik-cache/arm/system@[email protected] (Java_android_os_MessageQueue_nativePollOnce__JI+102)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   at android.os.MessageQueue.nativePollOnce(Native method)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   at android.os.MessageQueue.next(MessageQueue.java:153)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   at android.os.Looper.loop(Looper.java:131)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   at android.app.ActivityThread.main(ActivityThread.java:5696)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   at java.lang.reflect.Method.invoke!(Native method)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   at java.lang.reflect.Method.invoke(Method.java:372)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
    03-25 00:13:01.589 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/check_jni.cc:65] 
    03-25 00:13:01.979 5860-5860/com.antonioleiva.bandhookkotlin A/art: art/runtime/runtime.cc:284] Runtime aborting...
    

    Used this answer to fix it: http://stackoverflow.com/a/26638729. I couldn't find a way to do that via xml since android:transitionGroup was introduced in Lollipop.

    opened by squeezymo 2
  • build failed :BaseActivity.kt: (23, 27): Unresolved reference: find

    build failed :BaseActivity.kt: (23, 27): Unresolved reference: find

    I had added dependency as follow: compile "org.jetbrains.anko:anko-sdk15:$ankoVersion" compile "org.jetbrains.anko:anko-support-v4:$ankoVersion"

    now the ankoVersion is 0.8 but "org.jetbrains.anko.find" still can't found Can you help me? Thank you very much!

    opened by IssacZhou777 2
  • Interactors x RxJava

    Interactors x RxJava

    Hi!

    This isn't a issue, but it's more like some doubt.

    The Interactor pattern is quite simular to the Command pattern, just returning some Event instead of being void and didn't support undo like we saw in design pattern books. In this case, it is wrong to create a second method to call if we have a presenter with 2 or more calls - e.g creating some action in DetailsActivity - to Interactors?

    In bandhook the Thread Executor is from Path, which I cannot see working with RxJava. Those executors can be used with RxJava (I tried to accomplish that but without success)? I'm thinking to create some structure that the Interactor will return an Observable instead of some Event (I use this in normal Java development, but not Kotlin until now). If you think that this can be useful, I can made a PR to the project with this second approach.

    opened by cavarzan 2
  • Update dependencies and fix broken code.

    Update dependencies and fix broken code.

    Hi @antoniolg .

    This PR contains all third-party dependencies updated, and code updated accordingly. See my comments for details.

    PD: AlbumsFragmentTest is not passing due to a non-mockable dependency in AlbumsFragment:

    recycler = autoFitRecycler().apply(AutofitRecyclerView::style)

    opened by vic-gonzi 1
  • Fix missing gradle files

    Fix missing gradle files

    Android projects should use and commit gradle wrapper. I had to copy these files from another project in order to compile the app.

    Moreover, gradle.properties contains org.gradle.jvmargs option allowing to speed build times for every developers.

    opened by pgreze 1
  • Unresolved reference: last_fm_api_key

    Unresolved reference: last_fm_api_key

    I'm trying to build this via ./gradlew clean build and I'm getting following error : `Download https://dl.google.com/dl/android/maven2/com/android/support/support-annotations/27.0.2/support-annotations-27.0.2.jar Download https://jcenter.bintray.com/com/google/code/gson/gson/2.7/gson-2.7.jar Download https://jcenter.bintray.com/org/jetbrains/anko/anko-sdk15/0.10.4/anko-sdk15-0.10.4.jar Download https://jcenter.bintray.com/org/jetbrains/anko/anko-design/0.10.4/anko-design-0.10.4.jar Download https://dl.google.com/dl/android/maven2/android/arch/lifecycle/common/1.0.3/common-1.0.3.jar e: /Users/plasta/Desktop/Bandhook-Kotlin-master/app/src/main/java/com/antonioleiva/bandhookkotlin/di/DataModule.kt: (28, 100): Unresolved reference: last_fm_api_key

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:compileDebugKotlin'.

    Compilation error. See log for more details

    • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    • Get more help at https://help.gradle.org

    Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0. See https://docs.gradle.org/4.5.1/userguide/command_line_interface.html#sec:command_line_warnings

    BUILD FAILED in 2m 27s `

    opened by deephole 1
  • Update instrumentation tests

    Update instrumentation tests

    AndroidTestCase and ActivityInstrumentationTestCase2 come from old and deprecated Android platform testing API.

    May we consider to migrate current UI tests to Espresso 3.0?

    opened by vic-gonzi 1
  • AlbumsFragmentTest failing on testOnCreateView

    AlbumsFragmentTest failing on testOnCreateView

    val createdView = albumsFragment.onCreateView(layoutInflater, null, null) // Then assertNotNull(albumsFragment.adapter)

    is failing as the container is null, if we mock the container it will fail as it will search for the context.

    opened by w3b5urf3r 0
  • FP Refactor

    FP Refactor

    DO NOT MERGE.

    This is a sample proof of concept refactoring the app to use a monad transformer stack pushing Kotlin as much as it can go with FP and functional combinators. This PR will remain as such as is not intended to be merged but showcases a different style of coding in Kotlin similar to that found in Scala or Haskell.

    The obvious limitation is the lack of support for Higher Kinds having to implement manually most of the combinators found on types such as EitherT[F[_], L, R] as part of the Result type.

    opened by raulraja 2
Owner
Antonio Leiva
Freelance trainer. I help you and your company to become Kotlin experts. GDE and Jetbrains Training Partner.
Antonio Leiva
Muhammad Valian Masdani 2 Jul 5, 2022
An Interpreter/Transpiler for the Folders esoteric programming language, a language with no code and just folders

Folders2kt ?? An Interpreter/Transpiler of the Folders esoteric programming language, a language with no code and just folders, written in Kotlin Show

Jens Klingenberg 18 Jan 4, 2023
Showcase project of Functional Reactive Programming on Android, using RxJava.

FunctionalAndroidReference FunctionalAndroidReference is a showcase project of Functional Reactive Programming on Android, using RxJava. It's a compan

Paco 278 Nov 18, 2022
Modular Android architecture which showcase Kotlin, MVVM, Navigation, Hilt, Coroutines, Jetpack compose, Retrofit, Unit test and Kotlin Gradle DSL.

SampleCompose Modular Android architecture which showcase Kotlin, MVVM, Navigation, Hilt, Coroutines, Jetpack compose, Retrofit, Unit test and Kotlin

Mohammadali Rezaei 7 Nov 28, 2022
An Android application to showcase dog images

DogApp An Android application to showcase dog images. The application allows users to see random dog images or random dog images by breed.The user can

Kieran 2 Nov 2, 2022
Demonstration of Object Pool Design Pattern using Kotlin language and Coroutine

Object Pool Design Pattern with Kotlin Demonstration of Thread Safe Object Pool Design Pattern using Kotlin language and Coroutine. Abstract The objec

Enes Kayıklık 7 Apr 12, 2022
Android Multi Theme Switch Library ,use kotlin language ,coroutine ,and so on ...

Magic Mistletoe Android多主题(换肤)切换框架 背景 时隔四年,在网易换肤之前的思路下,做了几点改进,现在完全通过反射创建View,并且在SkinLoadManager中提供一个configCustomAttrs以支持自定义View的属性插队替换 摈弃了之前的AsyncTask

Mistletoe 18 Jun 17, 2022
It is a project that contains lessons and examples about Kotlin programming language. 🇰

Kotlin Tutorials What is Kotlin? I added the platforms it supports and great resources. You can access the article from the link below: https://medium

Halil Özel 94 Dec 22, 2022
101 examples for Kotlin Programming language.

This is a collection of runnable console applications that highlights the features of Kotlin programming language. The use of console application enab

Dody Gunawinata 192 Dec 1, 2022
The Okila server project uses the Spring boot framework and uses the Kotlin language

Okila-Server The Okila server project uses the Spring boot framework and uses the Kotlin language Format Response //The response successfully format

Nankai 1 Oct 25, 2021
Practising kotlin language

Kotlin Learning About this project : 1.Starting with kotlin. 2.Creating a birthday wishing program. ?? Tech Stack: [] [] ?? Main Page: HELLO WORLD BIR

Shruti Mishra 0 Dec 4, 2021
KVision allows you to build modern web applications with the Kotlin language

KVision allows you to build modern web applications with the Kotlin language, without any use of HTML, CSS or JavaScript. It gives you a rich hierarchy of ready to use GUI components, which can be used as builder blocks for the application UI.

Robert Jaros 985 Jan 1, 2023
A coding examples project about Kotlin Programming language. 🇰

Kotlin Tutorial ????‍?? What is Kotlin ❓ Kotlin is a new programming language, developed by JetBrains. Jetbrains is a popular software development com

Mustajab Ikram 4 Oct 11, 2022
A sample Music Player project that help you learn about Compose in Android

Music App Compose UI A sample Music Player project that help you learn about Compose in Android. Note that this app only contain UI and has no logic.

Hamidreza Sahraei 25 Dec 13, 2022
Search in the categories of movies, music, e-books and podcasts with the keyword

CaseStudy In this application, you can search in the categories of movies, music, e-books and podcasts with the keyword you want, add them to your fav

Abdullah Furkan Titiz 4 Dec 6, 2021
Kotrlin Programming Language Cross-Platform Development which includes Android, iOS and Backend. Pretty much everwhere.

Kotlin-Everywhere: Kotlin Programming Language Cross-Platform Development This is still a WIP but the idea is to create a tiny KOTLIN project that cou

Fernando Cejas 31 Aug 9, 2022
Lambë Language 7 Dec 21, 2022
A functional, fractional-byte programming language

Fig A functional, fractional-byte programming language. Tired of annoying Unicode codepages in your favorite golfing languages? Fig uses pure, printab

null 10 Dec 15, 2022
This is the interpreter of Hime language, a dialect of Lisp, run on JVM platform.

Hime Language About This is the interpreter of Hime language, a dialect of Lisp, running on JVM platform. Once a feature is finished and tested, and n

Hime Programming Language 8 Jul 12, 2022