skydoves / disneymotions Goto Github PK
View Code? Open in Web Editor NEW🦁 A Disney app using transformation motions based on MVVM (ViewModel, Coroutines, Flow, Room, Repository, Koin) architecture.
License: Apache License 2.0
🦁 A Disney app using transformation motions based on MVVM (ViewModel, Coroutines, Flow, Room, Repository, Koin) architecture.
License: Apache License 2.0
Just noticed small bug. Back arrow click is doing nothing in the movie details page.
Tested on Android Emulator Nexus 5 API 23
Cheers.
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.
Our backend developer returns the following data structure:
{ code: 0, msg: "success", data: { } }
How should this be handled globally?
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
I am little confused when comparing both your projects
As both use MVVM with Repository pattern and Coroutines what is the major difference between the two setup comparing only the architecture excluding the UI.
Thanks for sharing this great repo, It serves as a great reference point to building modern android app with good architecture implementation
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
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)
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 complete the following information:
Describe the Bug:
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.