A showcase music app for Android entirely written using Kotlin language

Related tags

App Bandhook-Kotlin
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
A Music Player for android that renders beautiful DNA(Visualization) of the currently playing music.

MusicDNA - A Music Player like no other A Music Player for android that makes use of the Visualizer Class for rendering a beautiful DNA (Visualization

Harjot Singh Oberai 2.8k Jan 5, 2023
Vanilla Music Player for Android (abandoned). Visit https://github.com/vanilla-music/vanilla for an actively developed fork

Translating You can help translate here. If your language isn't on the list, open an issue and I can add it. Building To build you will need: A Java c

Chris Eby 154 Dec 9, 2022
A music picker library for React Native. Provides access to the system's UI for selecting songs from the phone's music library.

Expo Music Picker A music picker library for React Native. Provides access to the system's UI for selecting songs from the phone's music library. Supp

Bartłomiej Klocek 60 Dec 29, 2022
An android app written in Kotlin Programming language which a user can use to store his/her monthly expenditure.

#Expenditure-Tracker An android app that allows the user to input , edit , view his/her expenditures for each month. Languages Used - Kotlin UI develo

Priyansh Agarwal 2 Aug 21, 2022
An simple image gallery app utilizing Unsplash API to showcase modern Android development architecture (MVVM + Kotlin + Retrofit2 + Hilt + Coroutines + Kotlin Flow + mockK + Espresso + Junit)

Imagine App An simple image gallery app utilizing Unsplash API. Built with ❤︎ by Wajahat Karim and contributors Features Popular photos with paginatio

Wajahat Karim 313 Jan 4, 2023
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Mike Penz 1.8k Nov 10, 2022
Popular Movies showcase android app

Pop Flix PopFlix is a gorgeous client application for TMDb on Android, built using Kotlin. Architecture and Tech-stack Built on MVVM architecture patt

Vishvendra Singh 5 Jun 7, 2022
📺 A sample app to showcase Twyper with GitHub repo search API

swipe-search A sample app to showcase Twyper with GitHub repo search API ?? Demo Screen.Recording.2022-02-20.at.9.36.10.PM.mov ?? Tech Stack What How

theapache64 26 Jul 18, 2022
Abel Suviri 6 Dec 16, 2022
RoboDemo is a ShowCase library for Android to demonstrate to users how a given Activity works.

RoboDemo RoboDemo is a ShowCase library for Android to demonstrate to users how a given Activity works. A sample is available in the download area of

Stéphane Nicolas 220 Nov 25, 2022
Calculator - A Simple Calculator Application Using Kotlin Language

Calculator A Simple Calculator Application Using Kotlin Language Some Screenshot

Shounak Das 3 Oct 17, 2022
Smart-flight - This app was created to learn and practice Kotlin language

Smart Flight This app was created to learn and practice Kotlin language. Works o

Kamil 1 Feb 9, 2022
[Android] In-app language changing library

Localization Library Android library for in-app language changes support in your application Feature In-app language changing Default language when fi

Akexorcist 960 Jan 5, 2023
📰👓Android App that fetches fresh news based on your language and location

News App that fetches fresh news based on your language and location. You can share and browse news in one click! How to install You can open it with

Valeria 1 Feb 21, 2022
Modern-android-lab - Kotlin Language learning lab

kotlin-code-labs Kotlin Language learning lab Run the code with Kotlin Compiler:

Samuel Owino 4 Nov 7, 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
A multi-modular Gradle project that encapsulates various modules to learn Kotlin language, tools and frameworks.

KotlinLearn This is a gradle project for the sole basis of exploring and learning Kotlin language, tools and frameworks. The root project wil encapsul

Victor Kiprop 2 Oct 10, 2021
Solutions to advent of code 2021 in the gen-Z programming language known as kotlin

Advent Of Code 2021 - Kotlin Edition How to run? Get the kotlin SDK using the sdkman tool: https://sdkman.io/sdks#kotlin Run the commands: ./gradlew

Arijan 2 Jan 7, 2022
DMPLayer is an Android music player prototype

DMPlayer DMPLayer is an Android music player prototype #License Copyright 2015 [email protected] Dibakar Mistry Licensed under the Apache License,

Dibakar Mistry 655 Nov 14, 2022