Giter Site home page Giter Site logo

skydoves / disneymotions Goto Github PK

View Code? Open in Web Editor NEW
1.5K 37.0 194.0 93.63 MB

🦁 A Disney app using transformation motions based on MVVM (ViewModel, Coroutines, Flow, Room, Repository, Koin) architecture.

License: Apache License 2.0

Kotlin 100.00%
android kotlin coroutines mvvm mvvm-architecture disney motions skydoves flow

disneymotions's Introduction

DisneyMotions


A demo Disney app using transformation motions based on MVVM architecture.
The motion system is included in the 1.2.0-alpha05 released material version.


Google
License API Build Status KotlinWeekly Medium Profile

Download

Go to the Releases to download the latest APK.

Screenshots

Tech stack & Open-source libraries

  • Minimum SDK level 21
  • 100% Kotlin based + Coroutines + Flow for asynchronous.
  • JetPack
    • Lifecycle - dispose observing data when lifecycle state changes.
    • ViewModel - UI related data holder, lifecycle aware.
    • Room Persistence - construct database.
  • Architecture
    • MVVM Architecture (View - DataBinding - ViewModel - Model)
    • Bindables - Android DataBinding kit for notifying data changes to UI layers.
    • Repository pattern
    • Koin - dependency injection
  • Material Design & Animations
  • Sandwich - construct lightweight network response interfaces and handling error responses.
  • Retrofit2 & Gson - constructing the REST API
  • OkHttp3 - implementing interceptor, logging and mocking web server
  • Glide - loading images
  • BaseRecyclerViewAdapter - implementing adapters and viewHolders
  • WhatIf - checking nullable object and empty collections more fluently
  • Bundler - Android Intent & Bundle extensions that insert and retrieve values elegantly.
  • Timber - logging
  • Ripple animation, Shared element container transform/transition

MAD Score

summary kotlin

Unit Testing Frameworks

Unit Tests verify the interactions of viewmodels between repositories and dao & REST api requests.

  • Robolectric - Robolectric is the industry-standard unit testing framework for Android.
  • Mockito-Kotlin - a small library that provides helper functions to work with Mockito in Kotlin.

screenshot483387955

Contents Credits

All copyrights of the contents, concepts, and phrases used for this open-source project belong to The Walt Disney Company.

Find this repository useful? ❤️

Support it by joining stargazers for this repository. ⭐
And follow me for my next creations! 🤩

License

Designed and developed by 2020 skydoves (Jaewoong Eum)

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.

disneymotions's People

Contributors

skydoves avatar sukie2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

disneymotions's Issues

Type mismatch required LiveData<TypeVariable(T)> found Unit

I'm trying to understanding this architecture by coding example and I followed the project set up
till I stuck with that compile time error

Type mismatch required LiveData<TypeVariable(T)> found Unit

in the viewModel I have code like that for register request

 fun postRegisterRequest(request: RegisterRequest) {
    this.registerLiveData =  launchOnViewModelScope {
            this.authRepository.postRegister ({ s -> this.toastLiveData.postValue(s) },
                request
            )
        }
}

in the repository I have the following code

suspend fun postRegister(error: (String) -> Unit, request: RegisterRequest) = withContext(Dispatchers.IO) {
    val liveData = MutableLiveData<ResponseWrapper<RegisterResponse>>()
    isLoading = true
    networkClient.postRegister( { response ->
        isLoading = false
        when (response) {
            is ApiResponse.Success -> {
                response.data.whatIfNotNull {
                    liveData.postValue(it)
                }
            }
            is ApiResponse.Failure.Error -> error(response.message())
            is ApiResponse.Failure.Exception -> error(response.message())
        }
    },request)
}

the network client request look like that

 fun postRegister(
    onResult: (response: ApiResponse<ResponseWrapper<RegisterResponse>>) -> Unit,
    request: RegisterRequest
) {
    this.authService.register(request).transform(onResult)
}

the authService code

  @POST(Urls.REGISTER)
fun register(@Body request: RegisterRequest): Call<ResponseWrapper<RegisterResponse>>

what I did wrong and how to make postRegister in the repository return LiveData<TypeVariable(T)> instead of Unit

Animation does not start

  • Affected Device(s) [Pixel 3A API 28]

Describe the Bug:

The navigation works when clicking a movie, but the animation does doesn't. This only occurs on API 28. I've tested API 29, 27, 26; all of which work fine.

Expected Behavior:

Clicking on a movie should should start the material transform animation.

Crash when select first item

Please complete the following information:

  • Library Version [e.g. v1.0.0]
  • Affected Device(s) [e.g. Nokia 6.1+ with Android 10.0]

Describe the Bug:

  • Running the app
  • Select the first item, I have try at all tabs. All the result same.
  • The app will crash

Crash when select first item

This is the error log

FATAL EXCEPTION: main
    Process: com.skydoves.disneymotions, PID: 18526
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.skydoves.disneymotions/com.skydoves.disneymotions.view.ui.details.PosterDetailActivity}: java.lang.IllegalArgumentException: Required value was null.
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3271)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3410)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2017)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7397)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
     Caused by: java.lang.IllegalArgumentException: Required value was null.
        at com.skydoves.disneymotions.extensions.ActivityExtensionsKt$extraLong$1.invoke(ActivityExtensions.kt:63)
        at com.skydoves.disneymotions.extensions.ActivityExtensionsKt$extraLong$1.invoke(Unknown Source:0)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at com.skydoves.disneymotions.view.ui.details.PosterDetailActivity.getPosterId(Unknown Source:2)
        at com.skydoves.disneymotions.view.ui.details.PosterDetailActivity.onCreate(PosterDetailActivity.kt:41)
        at android.app.Activity.performCreate(Activity.java:7802)
        at android.app.Activity.performCreate(Activity.java:7791)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1300)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3246)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3410) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2017) 
        at android.os.Handler.dispatchMessage(Handler.java:107) 
        at android.os.Looper.loop(Looper.java:214) 
        at android.app.ActivityThread.main(ActivityThread.java:7397) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935) 
I: Sending signal. PID: 18526 SIG: 9

Expected Behavior:

Not crash when select first item

Adjust the color of the status bar to match the prominent background color of image.

Is your feature request related to a problem?

The color of the status bar doesn't go together with the prominent background color of the selected movie.

Describe the solution you'd like:

The status bar color should be dynamically adjusted to the prominent background color of the selected movie.

Describe alternatives you've considered:

Use the Palette API to select the prominent background color of the selected movie. During runtime change the status bar color to the color selected from the palette.

Please help me this error

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;

import android.annotation.SuppressLint;
import android.os.Bundle;

import com.example.appnhac2.Adapter.MainViewPagerAdapter;
import com.example.appnhac2.Fragment.Fragment_Tim_Kiem;
import com.example.appnhac2.Fragment.Fragment_Trang_Chu;
import com.example.appnhac2.R;
import com.google.android.material.tabs.TabLayout;

public class MainActivity extends AppCompatActivity {

TabLayout tabLayout;
ViewPager viewPager;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    anhxa();
    init();
}

private void init() {
    MainViewPagerAdapter mainViewPagerAdapter = new MainViewPagerAdapter(getSupportFragmentManager());
    mainViewPagerAdapter.addFragment(new Fragment_Trang_Chu(), "Trang Chu");
    mainViewPagerAdapter.addFragment(new Fragment_Tim_Kiem(), "Tim Kiem");
    viewPager.setAdapter(mainViewPagerAdapter);
    tabLayout.setupWithViewPager(viewPager);
    tabLayout.getTabAt(0).setIcon(R.drawable.icontrangchu);
    tabLayout.getTabAt(1).setIcon(R.drawable.iconsearch);
}
@SuppressLint("WrongViewCast")
private void anhxa() {
    tabLayout = findViewById(R.id.myTabLayout);
    viewPager = findViewById(R.id.myViewPager);
}

}

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.appnhac2, PID: 10439
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.appnhac2/com.example.appnhac2.Ativity.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.viewpager.widget.ViewPager.setAdapter(androidx.viewpager.widget.PagerAdapter)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.viewpager.widget.ViewPager.setAdapter(androidx.viewpager.widget.PagerAdapter)' on a null object reference
at com.example.appnhac2.Ativity.MainActivity.init(MainActivity.java:32)
at com.example.appnhac2.Ativity.MainActivity.onCreate(MainActivity.java:25)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) 
at android.os.Handler.dispatchMessage(Handler.java:107) 
at android.os.Looper.loop(Looper.java:214) 
at android.app.ActivityThread.main(ActivityThread.java:7356) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 

Tests to be added

Is your feature request related to a problem?
No

The arch. of the app is really good, but for a developer to get more understanding on how to test such an app, tehre should be tests included.

Describe the solution you'd like:
Unit tests, integration and some UI tests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.